We read your photo as:

Solve the quadratic equation x2 + 6x − 7 = 0 using the completing the square method.

Mathematics

ScanSolve AI Answer

Answer

x1=1,x2=−7x_1 = 1, x_2 = -7

Step-by-step solution

5 steps

To solve the quadratic equation x2+6x−7=0x^2 + 6x - 7 = 0 using the completing the square method, we follow these algebraic steps:

  1. Move the constant term to the right side of the equation.

    x2+6x=7x^2 + 6x = 7
  2. Take half of the coefficient of the xx term, square it, and add it to both sides of the equation.

    The coefficient of xx is 6, so half of it is 3, and 32=93^2 = 9.

    x2+6x+9=7+9x^2 + 6x + 9 = 7 + 9
  3. Factor the left side as a perfect square and simplify the right side.

    (x+3)2=16(x+3)^2 = 16
  4. Take the square root of both sides.

    Remember to include both positive and negative roots.

    x+3=±16x+3 = \pm\sqrt{16} x+3=±4x+3 = \pm 4
  5. Solve for xx by isolating it.

    x=−3±4x = -3 \pm 4

    This gives two solutions:

    x1=−3+4=1x_1 = -3 + 4 = 1 x2=−3−4=−7x_2 = -3 - 4 = -7

    Here is the simple MATLAB code that implements these steps:

    % MATLAB code to solve x^2 + 6x - 7 = 0 using the completing the square method
    
    % Define coefficients of the quadratic equation ax^2 + bx + c = 0
    a = 1;
    b = 6;
    c = -7;
    
    % Step 1: Move the constant term to the right side and normalize by 'a'
    % The equation becomes x^2 + (b/a)x = -c/a
    % Since a=1 for this equation, it simplifies to x^2 + bx = -c
    b_normalized = b / a; % Coefficient of x term after dividing by a
    c_constant_on_right = -c / a; % Constant term on the right side after dividing by a
    
    % Step 2: Calculate the term needed to complete the square
    % This term is (b_normalized / 2)^2
    term_to_add = (b_normalized / 2)^2;
    
    % Step 3: Add the term to both sides
    % The left side becomes (x + b_normalized/2)^2
    % The right side becomes c_constant_on_right + term_to_add
    right_side_value = c_constant_on_right + term_to_add;
    
    % Step 4: Take the square root of both sides
    % x + b_normalized/2 = +/- sqrt(right_side_value)
    % Use 'complex' to handle cases where right_side_value might be negative (complex roots)
    if right_side_value < 0
        sqrt_part = sqrt(complex(right_side_value));
    else
        sqrt_part = sqrt(right_side_value);
    end
    
    % Step 5: Solve for x
    x1 = -b_normalized / 2 + sqrt_part;
    x2 = -b_normalized / 2 - sqrt_part;
    
    % Display the solutions
    fprintf('The quadratic equation is x^2 + 6x - 7 = 0.\n');
    fprintf('Solutions using the completing the square method:\n');
    fprintf('x1 = %f\n', x1);
    fprintf('x2 = %f\n', x2);
    

    When you run this MATLAB code, the output will be:
    The quadratic equation is x^2 + 6x - 7 = 0.
    Solutions using the completing the square method:
    x1 = 1.000000
    x2 = -7.000000

    The solutions are x1=1,x2=−7x_1 = 1, x_2 = -7.

Was this helpful?

Try one yourself

A new problem that tests the same skill.

Still stuck on this one?

Ask a follow-up, and the answer starts from this question.

Got a different question?Ask your own question