Completing the Square Calculator is a free online tool that displays values for quadratic equations using the completing the square method. STUDYQUERIES’s online completing the square calculator tool makes the calculation faster, and it displays the value of the variable in a fraction of a second.

How to Use the Completing the Square Calculator?

Using the completing the square calculator is as follows:

  • Step 1: Enter the expression in the input box
  • Step 2: To get the result, click “Solve by Completing the Square”
  • Step 3: In the new window, the variable value will be displayed for the given expression

Completing The Square Calculator

SOHCAHTOA – Definition & Example

Derivative of tan x, sec x & tan x More

Rectangular To Polar Calculator

What Is Completing The Square?

Completing the square is used to convert a quadratic expression of the form

$$ax^2 + bx + c$$

As a vertex

$$a(x – h)^2 + k$$

In solving a quadratic equation, completing the square is the most common application. You can do this by rearranging the expression obtained after completing the square:

$$a(x + m)^2 + n$$

Completing The Square Calculator
Completing The Square Calculator

In other words, the left side is a perfect square trinomial. Completing the square method can be useful in:

  • An expression in quadratic form can be converted into a vertex form
  • Analyzing the point at which a quadratic expression has the minimum or maximum value
  • Graphing quadratic functions
  • The solution to a quadratic equation
  • Calculating the quadratic formula

With the help of solved examples, let’s understand the completing the square formula and its applications.

Completing the Square Method

Completing the square method is often used to factor a quadratic equation, and subsequently to find its roots and zeros. In fact, quadratic equations of the form

$$ax^2 + bx + c = 0$$

The problem can be solved by factorization. But sometimes, factorizing the quadratic expression

$$ax^2 + bx + c$$

is complex or NOT possible. This can be understood by looking at the following example.

For example: $$x^2 + 2x + 3$$

As we cannot find two numbers whose sum is 2 and whose product is 3, this cannot be factored in. Instead, it is written in the following way.

$$a(x + m)^2 + n$$

by completing the square. Since we have

$$(x + m)$$

When we have the whole squared, we say that we have “completed the square.”. However, how do we complete the square? We will examine the concept in more detail below.

Completing the Square Formula

Complete the square formula is a technique or method for converting a quadratic polynomial or equation into a perfect square with some additional constant. A quadratic expression in variable x is as follows:

$$ax^2 + bx + c,\ where\ a,\ b\ and\ c\ are\ any\ real\ numbers\ but\ a \neq 0$$

can be converted into a perfect square with some additional constant by using completing the square formula or technique.

Note: Completing the square formula is used to derive the quadratic formula.

Completing the square formula is a technique or method that can also be used to find the roots of the given quadratic equations, $$ax^2 + bx + c,\ where\ a,\ b\ and\ c\ are\ any\ real\ numbers\ but\ a \neq 0$$

The formula for completing the square is:

$$ax^2 + bx + c ⇒ a(x + m)^2 + n$$

where m is any real number and n is a constant term.

Rather than using a complex step-by-step method to complete the square, we can use the following simple formula to complete it. To complete the square in the expression

$$ax^2 + bx + c$$

first, find:

$$m = \frac{b}{2a}\ and\ n = c – \frac{b^2}{4a}$$

Substitute these values in:

$$ax^2 + bx + c = a(x + m)^2 + n$$

The formulas are derived geometrically. Would you like to know how? This will be explained with illustrations in the following sections.

Examples To Understand Completing the Square Formula 

Here are a few examples of the application of the completing the square formula,

Example: Using completing the square formula, find the number that should be added to $$x^2 – 7x$$ in order to make it a perfect square trinomial?

Solution: The given expression is $$x^2 – 7x$$

Method 1: Comparing the given expression with $$ax^2 + bx + c, a = 1; b = -7$$

Using the formula, the term that should be added to make the given expression a perfect square trinomial is,

$$m = \frac{b}{2a}^2$$

$$= \frac{-7}{2\times 1}$$

$$= 49/4$$

Thus, from both the methods, the term that should be added to make the given expression a perfect square trinomial is 49/4.

Method 2: The coefficient of x is -7. Half of this number is -7/2. Finding the square,

$$\frac{-7}{2\times 1}^2 = 49/4$$

Example: Use completing the square formula to solve: $$x^2 – 4x – 8 = 0$$

Solution: Method 1:

Using formula, $$ax^2 + bx + c = a(x + m)^2 + n. Here,\ a = 1,\ b = -4,\ c = -8$$

$$\Rightarrow m = \frac{b}{2a} = \frac{-4}{2\times 1} = -2$$

and, $$n = c – \frac{b^2}{4a} =-8- \frac{(-4)^2}{4\times 1} = -12$$

$$\Rightarrow x^2 – 4x – 8 = (x – 2)^2 – 12$$

$$\Rightarrow (x – 2)^2 = 12$$

$$\Rightarrow (x – 2) = \pm \sqrt{12}$$

$$\Rightarrow x – 2 = \pm 2\sqrt{3}$$

$$\Rightarrow x = 2 \pm 2\sqrt{3}$$

Method 2: Let’s transpose the constant term to the other side of the equation:

$$x^2 – 4x = 8$$

Take half of the coefficient of the x-term, which is -4, including the sign, which gives -2. Square -2 to get +4, and add this squared value to both sides of the equation:

$$x^2 – 4x + 4 = 8 + 4$$

$$\Rightarrow x^2 – 4x + 4 = 12$$

On the left-hand side of the equation, the result is a quadratic expression that is a perfect square. The quadratic can be replaced with the squared-binomial form as follows:

$$(x – 2)^2 = 12$$

Now, we’ve completed the expression to create a perfect-square binomial, let’s solve:

$$(x – 2)^2 = 12$$

$$\Rightarrow (x – 2) = \pm \sqrt{12}$$

$$\Rightarrow x – 2 = \pm 2\sqrt{3}$$

$$\Rightarrow x = 2 \pm 2\sqrt{3}$$

Answer: Using completing the square method, $$x = 2 \pm 2\sqrt{3}$$

Quick Solving Of Quadratic Equations Using Completing the Square Method

Let us complete the square in the expression

$$ax^2 + bx + c$$

using Geometry. Based on the method studied earlier, the coefficient of x2 must be made ‘1’ by taking ‘a’ as the common factor. We get,

$$ax^2 + bx + c = a[x^2+\frac{b}{a}x+\frac{c}{a}]\longrightarrow (1)$$

Now, we will consider the first two terms,

$$x^2\ and\ \frac{b}{a}x$$

Let us consider a square of side ‘x’ (whose area is x²). Let us also consider a rectangle of length (b/a) and breadth (x) (whose area is (b/a)x).

Using geometry, complete the square by using a square of sides x and a rectangle of length b/a and width x.

Divide the rectangle into two equal parts now. b/2a will be the length of each rectangle.

Solving Quadratic Equations Using Completing the Square Method Step 2
Solving Quadratic Equations Using Completing the Square Method Step 2

Completing the square with geometry – The rectangle is divided into two equal parts. Each rectangle has a length of b/(2a).

Attach half of this rectangle to the right side of the square and the remaining half to the bottom.

Solving Quadratic Equations Using Completing the Square Method Step 3
Solving Quadratic Equations Using Completing the Square Method Step 3

The rectangles are rearranged so that half of the rectangles are attached to the right side of the square and the other half to the bottom of the square.

A geometric square is incomplete without a square of side b/2a. The square of area [(b/2a)²] should be added to

$$x^2 + \frac{b}{a}x$$

to complete the square. But, we cannot just add, we need to subtract it as well to retain the expression’s value. Thus, to complete the square:

$$x^2 + \frac{b}{a}x= x^2 + \frac{b}{a}x + \left(\frac{b}{2a} \right)^2 – \left(\frac{b}{2a} \right)^2$$

$$= x^2 + \frac{b}{a}x + \frac{b}{2a}^2 – \frac{b^2}{4a^2}$$

Multiplying and dividing $$\frac{b}{a}x$$ with 2 gives, $$x^2 + (2\times x\times \frac{b}{2a}) + \left(\frac{b}{2a} \right)^2 – \frac{b^2}{4a^2}$$

By using the identity, $$x^2 + 2xy + y^2 = (x + y)^2$$

The above equation can be written as,

$$x^2 + bax = (x + \frac{b}{2a})^2 – \frac{b^2}{4a^2}$$

By substituting this in (1): $$ax^2 + bx + c = a((x + \frac{b}{2a})^2 – \frac{b^2}{4a^2} + \frac{c}{a}$$

$$= a(x + \frac{b}{2a})^2 – \frac{b^2}{4a} + c$$

$$= a(x + \frac{b}{2a})^2 + (c – \frac{b^2}{4a})$$

This is of the form $$a(x + m)^2 + n$$ where,

$$m = \frac{b}{2a}$$

$$n = c – \frac{b^2}{4a}$$

Example: We will complete the square in $$-4x^2 – 8x – 12$$ using this formula. Comparing this with $$ax^2 + bx + c, a = -4; b = -8; c = -12$$

Find the values of ‘m’ and ‘n’ using:

$$m = \frac{b}{2a} = \frac{-8}{2(-4)} = 1$$

$$n = c – \frac{b^2}{4a} = -12 – \frac{(-8)^2}{4(-4)} = -8$$

Substitute these values in: $$ax^2 + bx + c = a(x + m)^2 + n$$

We get: $$- 4x^2 – 8x – 12 = -4(x + 1)^2 – 8$$

We will observe that we will arrive at the same answer using the stepwise method also in the next section.

How to Apply Completing the Square Method?: Step to Step Guide

Let us learn how to apply the completing the square method using an example.

Example: Complete the square in the expression $$-4×2 – 8x – 12$$

Solution: First, we should make sure that the coefficient of x² is ‘1’. If the coefficient of x² is NOT 1, we will place the number outside as a common factor. We will get:

$$-4x^2 – 8x – 12 = -4(x^2 + 2x + 3)$$

Now, the coefficient of x² is 1.

Step 1: Find half of the coefficient of x.

Here, the coefficient of ‘x’ is 2. Half of 2 is 1.

Step 2: Find the square of the above number.

$$1² = 1$$

Step 3: Add and subtract the above number after the x term in the expression whose coefficient of x² is 1.

$$-4(x^2 + 2x + 3) = -4(x^2 + 2x + 1 – 1 + 3)$$

Step 4: Factorize the perfect square trinomial formed by the first 3 terms using the identity $$x^2 + 2xy + y^2 = (x + y)^2$$

In this case, $$x^2 + 2x + 1 = (x + 1)^2$$

The above expression from Step 3 becomes:

$$-4(x^2 + 2x + 1 – 1 + 3) = -4((x + 1)^2 – 1 + 3)$$

Step 5: Simplify the last two numbers.

Here, $$-1 + 3 = 2$$

Thus, the above expression is: $$-4x^2 – 8x – 12 = -4(x + 1)^2 – 8$$

This is of the form $$a(x + m)^2 + n$$ Hence, we have completed the square. Thus, $$-4x^2 – 8x – 12 = -4(x + 1)^2 – 8$$

To complete the square in an expression $$ax^2 + bx + c$$

Make sure the coefficient of x² is 1.

Add and subtract (b/2)² after the ‘x’ term and simplify.

Short Trick to Understand Completing the Square Method

The following steps will help you learn how to apply the square technique.

  • Step 1: Note down the form we wish to obtain after completing the square: $$a(x + m)^2 + n$$
  • Step 2: After expanding, we get, $$ax^2 + 2amx + am^2 + n$$
  • Step 3: Compare the given expression, say $$ax^2 + bx + c$$ and find m and n as $$m = \frac{b}{2a}\ and\ n = c – \frac{b^2}{4a}$$

Solve By Completing The Square Calculator:

This calculator helps solve quadratic equations by completing the square method. It takes an equation in the form of ax^2 + bx + c = 0 and provides the solutions by completing the square. For example, if we have the equation 2x^2 + 4x – 6 = 0, the calculator would provide the solutions by completing the square to obtain the values of x.

Example:
Given equation: 2x^2 + 4x – 6 = 0
Solution:
Step 1: Move the constant term to the right side: 2x^2 + 4x = 6
Step 2: Divide the entire equation by the coefficient of x^2 to make the leading coefficient 1: x^2 + 2x = 3
Step 3: Take half of the coefficient of x (2) and square it to get 2^2 = 4.
Step 4: Add the squared value to both sides of the equation: x^2 + 2x + 4 = 3 + 4
Step 5: Simplify: x^2 + 2x + 4 = 7
Step 6: Rewrite the left side of the equation as a perfect square: (x + 1)^2 = 7
Step 7: Take the square root of both sides: x + 1 = ±√7
Step 8: Solve for x: x = -1 ± √7

Solving Quadratic Equations By Completing The Square Calculator:

Similar to the previous calculator, this tool specifically focuses on solving quadratic equations using the completing the square method. It provides a step-by-step process to solve the equation and find the values of x. For instance, if we have the equation x^2 – 5x + 6 = 0, the calculator would guide us through the steps of completing the square to find the solutions.

Example:
Given equation: x^2 – 5x + 6 = 0
Solution:
Step 1: Move the constant term to the right side: x^2 – 5x = -6
Step 2: Divide the entire equation by the coefficient of x^2 to make the leading coefficient 1: x^2 – 5x = -6
Step 3: Take half of the coefficient of x (-5) and square it to get (-5/2)^2 = 6.25.
Step 4: Add the squared value to both sides of the equation: x^2 – 5x + 6.25 = -6 + 6.25
Step 5: Simplify: x^2 – 5x + 6.25 = 0.25
Step 6: Rewrite the left side of the equation as a perfect square: (x – 2.5)^2 = 0.25
Step 7: Take the square root of both sides: x – 2.5 = ±√0.25
Step 8: Solve for x: x = 2.5 ± 0.5

Completing The Square Formula Calculator:

This calculator is designed to calculate the value of completing the square formula for a given quadratic equation. It takes the equation in the form of ax^2 + bx + c = 0 and computes the formula. For example, if we have the equation 3x^2 + 6x – 9 = 0, the calculator would provide the completing the square formula.

Example:
Given equation: 3x^2 + 6x – 9 = 0
Solution:
Step 1: Divide the entire equation by the coefficient of x^2 to make the leading coefficient 1: x^2 + 2x – 3 = 0
Step 2: Take half of the coefficient of x (2) and square it to get 2^2 = 4.
Step 3: Add the squared value to both sides of the equation: x^2 + 2x + 4 = 3 + 4
Step 4: Simplify: x^2 + 2x + 4 = 7
Step 5: The completing the square formula for this equation is (x + 1)^2 = 7

Completing The Square Calculator With Steps:

This calculator not only solves quadratic equations using the completing the square method but also shows the step-by-step process. It helps users understand how to complete the square by breaking down each step involved in the calculation. By inputting an equation like 4x^2 – 8x + 3 = 0, the calculator would provide the detailed steps for completing the square and finding the solutions.

Example:
Given equation: 4x^2 – 8x + 3 = 0
Solution:
Step 1: Move the constant term to the right side: 4x^2 – 8x = -3
Step 2: Divide the entire equation by the coefficient of x^2 to make the leading coefficient 1: x^2 – 2x = -0.75
Step 3: Take half of the coefficient of x (-2) and square it to get (-2/2)^2 = 1.
Step 4: Add the squared value to both sides of the equation: x^2 – 2x + 1 = -0.75 + 1
Step 5: Simplify: x^2 – 2x + 1 = 0.25
Step 6: Rewrite the left side of the equation as a perfect square: (x – 1)^2 = 0.25
Step 7: Take the square root of both sides: x – 1 = ±√0.25
Step 8: Solve for x: x = 1 ± 0.5

Solve By Completing The Square Calculator With Work:

Similar to the previous calculator, this tool not only solves quadratic equations but also shows the work involved in completing the square. It provides a comprehensive breakdown of the calculations performed at each step. For instance, if we have the equation x^2 + 4x – 5 = 0, the calculator would display the work involved in completing the square to find the solutions.

Example:
Given equation: 2x^2 + 8x + 6 = 0
Solution:
Step 1: Move the constant term to the right side: 2x^2 + 8x = -6
Step 2: Divide the entire equation by the coefficient of x^2 to make the leading coefficient 1: x^2 + 4x = -3
Step 3: Take half of the coefficient of x (4) and square it to get 4^2 = 16.
Step 4: Add the squared value to both sides of the equation: x^2 + 4x + 16 = -3 + 16
Step 5: Simplify: x^2 + 4x + 16 = 13
Step 6: Rewrite the left side of the equation as a perfect square: (x + 2)^2 = 13
Step 7: Take the square root of both sides: x + 2 = ±√13
Step 8: Solve for x: x = -2 ± √13

Complete The Square Formula:

This formula is used to transform a quadratic equation into a perfect square trinomial. The complete the square formula is expressed as (x + a)^2 = b, where a and b are constants. This formula is particularly useful when solving quadratic equations by completing the square method. For example, if we have the equation x^2 + 6x + 9 = 0, we can see that it can be rewritten as (x + 3)^2 = 0 using the complete the square formula.

Example:
Given equation: 3x^2 – 6x + 2 = 0
Solution:
Step 1: Divide the entire equation by the coefficient of x^2 to make the leading coefficient 1: x^2 – 2x + 2/3 = 0
Step 2: Take half of the coefficient of x (-2) and square it to get (-2/2)^2 = 1.
Step 3: Add the squared value to both sides of the equation: x^2 – 2x + 1 = 1 – 2/3
Step 4: Simplify: x^2 – 2x + 1 = 1/3
Step 5: The completing the square formula for this equation is (x – 1)^2 = 1/3

Solve By Completing The Square:

This refers to the method of solving quadratic equations by completing the square. It involves manipulating the equation to transform it into a perfect square trinomial and then taking the square root to find the solutions. For instance, if we have the equation 2x^2 + 8x + 6 = 0, we can solve it by completing the square to obtain the values of x.

Example:
Given equation: x^2 + 6x + 9 = 0
Solution:
Step 1: Move the constant term to the right side: x^2 + 6x = -9
Step 2: Divide the entire equation by the coefficient of x^2 to make the leading coefficient 1: x^2 + 6x = -9
Step 3: Take half of the coefficient of x (6) and square it to get 6^2 = 36.
Step 4: Add the squared value to both sides of the equation: x^2 + 6x + 36 = -9 + 36
Step 5: Simplify: x^2 + 6x + 36 = 27
Step 6: Rewrite the left side of the equation as a perfect square: (x + 3)^2 = 27
Step 7: Take the square root of both sides: x + 3 = ±√27
Step 8: Solve for x: x = -3 ± 3√3

(X+A)^2=B Calculator:

This calculator solves equations of the form (x + a)^2 = b. It takes the values of a and b as inputs and calculates the possible values of x. For example, if we have the equation (x + 2)^2 = 16, the calculator would provide the solutions for x.

Example:
Given equation: (x + 2)^2 = 16
Solution:
Step 1: Take the square root of both sides: x + 2 = ±√16
Step 2: Solve for x: x = -2 ± 4
Solution: x = 2 or x = -6

Complete The Square To Find The Vertex Calculator:

This calculator uses the completing the square method to find the vertex of a quadratic function. It takes the quadratic function in the form of f(x) = ax^2 + bx + c and determines the coordinates of the vertex. For instance, if we have the function f(x) = x^2 + 4x + 3, the calculator would find the vertex by completing the square and provide the coordinates.

Example:
Given equation: y = x^2 – 4x + 3
Solution:
Step 1: Rewrite the equation in vertex form by completing the square: y = (x – 2)^2 – 1
Solution: The vertex of the parabola is (2, -1).

Find The Square Root Calculator:

This calculator calculates the square root of a given number. It is not directly related to completing the square, but it can be useful when solving quadratic equations by taking the square root of both sides after completing the square. For example, if we have the equation x^2 = 25, we can use the square root calculator to find the solutions as x = ±5.

Example:
Given number: 25
Solution:
Step 1: Take the square root of 25: √25 = 5
Solution: The square root of 25 is 5.

Square Equation Calculator:

This calculator solves equations involving squares, which may or may not be quadratic equations. It is a more general tool that can handle equations like x^4 – 16 = 0 or x^2 + 4x = 12. It is not specific to completing the square method but can be used in conjunction with it to solve certain types of equations.

Example:
Given equation: x^2 – 9 = 0
Solution:
Step 1: Take the square root of both sides: x = ±√9
Step 2: Solve for x: x = 3 or x = -3
Solution: The solutions to the equation are x = 3 and x = -3.

Completing The Square Answers:

This term refers to the solutions obtained when solving quadratic equations using the completing the square method. The completing the square process provides the answers or values of x that satisfy the given equation. The “Completing The Square Answers” may refer to the solutions or roots of the quadratic equation found by completing the square method.

Example:
Given equation: x^2 + 6x + 9 = 0
Solution:
Step 1: Rewrite the equation in completed square form: (x + 3)^2 = 0
Solution: The solution to the equation is x = -3.

FAQs

How do you complete the square?

  • Step 1: Divide all terms by a (the coefficient of x2).
  • Step 2: Move the number term (c/a) to the right side of the equation.
  • Step 3: Complete the square on the left side of the equation and balance this by adding the same value to the right side of the equation.

What is the perfect square formula?

The perfect square formula is represented in form of two terms such as $$(a + b)^2$$ The expansion of the perfect square formula is expressed as $$(a + b)^2 = a^2 + 2ab + b^2$$

Why do we complete the square?

Completing the Square is a technique that can be used to find maximum or minimum values of quadratic functions. We can also use this technique to change or simplify the form of algebraic expressions. We can use it for solving quadratic equations.

How do you complete a square with two variables?

Move all terms containing x and y to one side, and the constant term (if there is) to the other side. Divide the equation by the coefficient of x and y if it’s different from one. Complete the square in x and y. Rearrange and identify its elements.

What is another name for square root?

The term (or number) whose square root is being considered is known as the radicand.

How To Solve By Completing The Square Calculator?

To solve a quadratic equation by completing the square using a calculator, follow these steps:
Step 1: Input the quadratic equation into the completing the square calculator.
Step 2: The calculator will rearrange the equation by moving the constant term to the other side.
Step 3: The calculator will divide the equation by the coefficient of the quadratic term to make the leading coefficient 1.
Step 4: The calculator will find the value of the coefficient of the linear term divided by 2, square it, and add it to both sides of the equation.
Step 5: The calculator will rewrite the left side of the equation as a perfect square.
Step 6: The calculator will take the square root of both sides to solve for the variable.
Step 7: The calculator will display the solution(s) for the quadratic equation.

How To Completing The Square On A Graphing Calculator Steps?

To complete the square on a graphing calculator, follow these steps:
Step 1: Enter the quadratic equation into the graphing calculator.
Step 2: Select the equation and choose the option to complete the square.
Step 3: The graphing calculator will rearrange the equation, move the constant term to the other side, and divide the equation by the coefficient of the quadratic term.
Step 4: The calculator will find the value of the coefficient of the linear term divided by 2, square it, and add it to both sides of the equation.
Step 5: The calculator will rewrite the left side of the equation as a perfect square.
Step 6: The calculator will take the square root of both sides to solve for the variable.
Step 7: The graphing calculator will display the solution(s) for the quadratic equation.

Why Is Completing The Square Called Completing The Square Calculator?

The term “completing the square” refers to a process used to manipulate a quadratic equation to transform it into a perfect square trinomial. This is achieved by adding a constant term to both sides of the equation. The resulting equation can then be factored into a binomial squared. The term “completing the square calculator” is used to refer to a calculator or tool that automates the process of completing the square for quadratic equations. It helps users quickly and accurately perform the steps involved in completing the square, providing the solutions or the transformed equation.

Completing The Square Calculator When C Is Not 0?

Completing the square can be done even when the coefficient of the constant term (C) is not zero. The general steps to complete the square in this case are as follows:
Step 1: Move the constant term to the other side of the equation.
Step 2: Divide the entire equation by the coefficient of the quadratic term to make the leading coefficient 1.
Step 3: Add the square of half the coefficient of the linear term to both sides of the equation.
Step 4: Rewrite the left side of the equation as a perfect square.
Step 5: Take the square root of both sides to solve for the variable.
Step 6: The calculator will display the solution(s) for the quadratic equation.

How To Solve A Quadratic Equation By Completing The Square Calculator?

To solve a quadratic equation by completing the square using a calculator, follow these steps:
Step 1: Input the quadratic equation into the completing the square calculator.
Step 2: The calculator will rearrange the equation by moving the constant term to the other side.
Step 3: The calculator will divide the equation by the coefficient of the quadratic term to make the leading coefficient 1.
Step 4: The calculator will find the value of the coefficient of the linear term divided by 2, square it, and add it to both sides of the equation.
Step 5: The calculator will rewrite the left side of the equation as a perfect square.
Step 6: The calculator will take the square root of both sides to solve for the variable.
Step 7: The calculator will display the solution(s) for the quadratic equation.

SOHCAHTOA – Definition & Example

Derivative of tan x, sec x & tan x More

Rectangular To Polar Calculator