Question
Write a C++ program which will take in data from the user as a quadratic and solve the quadratic by Completing the Square. The steps
Write a C++ program which will take in data from the user as a quadratic and solve the quadratic by Completing the Square. The steps to Completing the Square are as follows:
Applications of Completing the Square Method
Example 1: Solve the equation below using the method of completing the square.
Move the constant to the right side of the equation, while keeping the x-terms on the left. I can do that by subtracting both sides by 14.
Next, identify the coefficient of the linear term (just the x-term) which is
Take that number, divide by 2 and square it.
Add 81/4 to both sides of the equation, and then simplify.
Express the trinomial on the left side as a square of binomial.
Take the square roots of both sides of the equation to eliminate the power of 2 of the parenthesis. Make sure that you attach the plus or minus symbol to the constant term (right side of equation).
Solve for x by adding both sides by 9/2.
Find the two values of x by considering the two cases: positive and negative.
Therefore, the final answers are x1 = 7 and x2 = 2. You may back-substitute these two values of x from the original equation to check.
Example 2: Solve the equation below using the method of completing the square.
Solution:
Subtract 2 from both sides of the quadratic equation to eliminate the constant on the left side.
Divide 8 by 2 and square it.
Add 16 to both sides of the equation.
Express the left side as square of a binomial.
Take square roots of both sides.
Find the two values of x by considering the two cases: positive and negative.
Write a C++ program which will take in the value of a, b and c from the user and solve it by Completing the Square. Name your program CompleteSquare
Here are two sample outputs from the examples above:
and for the second example:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started