Tutorials › Calculus III › Completing Squares to Recognize a Sphere

Coordinates and Quadric Surfaces · Tutorial 5 of 999

Completing Squares to Recognize a Sphere

Rewrite a sphere equation by completing squares, then use the resulting constant to identify its geometric meaning.

Beginner 9 min read

What You'll Learn

  • Recognize the standard general equation of a sphere in three-dimensional Cartesian coordinates
  • Complete the square separately for the x, y, and z terms
  • Read the center and radius from center-radius form
  • Decide whether an equation describes a sphere, a single point, or no real points
  • Check a completed-square result by substitution into the original equation

From an Equation to a Sphere

A sphere is often given by its center and radius. But an equation may instead be presented with expanded quadratic and linear terms. Completing squares turns that equation into a form where the geometry can be read directly.

The essential calculation is one-dimensional: \(x^2+Ax\) can be rewritten as a square plus a constant. Doing this for all three coordinates reveals both the center and the squared radius. The sign of that final radius-squared value also tells us whether there are any real points satisfying the equation.

The Standard General Equation

In three-dimensional Cartesian coordinates, the standard general equation of a sphere is

$$ x^2+y^2+z^2+Ax+By+Cz+D=0, $$

where \(A\), \(B\), \(C\), and \(D\) are real constants. The coefficients of \(x^2\), \(y^2\), and \(z^2\) are equal, and there are no products such as \(xy\), \(xz\), or \(yz\). These features allow us to complete a square for each coordinate in the same way.

If all three squared terms have a common nonzero coefficient \(a\), first divide the equation by \(a\) to obtain the standard form above. An equation with unequal squared-term coefficients or additional mixed terms is not in this standard sphere form.

Definition: The center-radius form of a sphere is $$ (x-h)^2+(y-k)^2+(z-\ell)^2=r^2, $$ where the center is \((h,k,\ell)\) and the radius satisfies \(r>0\). If the right-hand side is zero, the equation describes just the center point; if it is negative, there are no real points satisfying the equation.

The center-radius form follows from the three-dimensional distance formula: the left side is the square of the distance from \((x,y,z)\) to \((h,k,\ell)\). Thus, when \(r^2>0\), the equation says precisely that the distance from each point on the surface to the center is \(r\).

Completing the Squares

The key identity is

$$ x^2+Ax=\left(x+\frac{A}{2}\right)^2-\frac{A^2}{4}. $$

It works because expanding the square gives \(x^2+Ax+\frac{A^2}{4}\), so subtracting \(\frac{A^2}{4}\) restores the original expression. Apply the identity to each coordinate in the general equation:

$$ \left(x+\frac{A}{2}\right)^2 +\left(y+\frac{B}{2}\right)^2 +\left(z+\frac{C}{2}\right)^2 = \frac{A^2+B^2+C^2}{4}-D. $$

This is the center-radius form when its right-hand side is positive. The values inside the squares identify the center, and the right-hand side is the square of the radius.

Theorem: For the equation $$ x^2+y^2+z^2+Ax+By+Cz+D=0, $$ the completed-square form has center $$ \left(-\frac{A}{2},-\frac{B}{2},-\frac{C}{2}\right) $$ and radius-squared value $$ r^2=\frac{A^2+B^2+C^2}{4}-D. $$ If \(r^2>0\), the equation describes a sphere of radius \(r=\sqrt{r^2}\). If \(r^2=0\), it has exactly one real solution point, the center. If \(r^2<0\), it has no real solutions.

Why the Sign Determines the Geometry

Each term on the left side of the completed-square equation is a square of a real number, so each term is nonnegative. Their sum is therefore nonnegative as well. It can equal a positive right-hand side, equal zero, or be unable to equal a negative right-hand side.

More precisely, if the sum of the squares equals zero, each individual square must be zero. That forces \(x=-A/2\), \(y=-B/2\), and \(z=-C/2\), so only the center point satisfies the equation. If the right-hand side is negative, even the sum's smallest possible value, zero, is too large. This proves the three cases in the theorem.

Worked Examples

Worked Example: Find the Center and Radius

Rewrite \(x^2+y^2+z^2-6x+4y-2z-2=0\) in center-radius form and identify its center and radius.

Group the terms by coordinate and move the constant to the right:

$$ (x^2-6x)+(y^2+4y)+(z^2-2z)=2. $$

For each pair, halve the linear coefficient and square the result: \(-6/2=-3\), \(4/2=2\), and \(-2/2=-1\). The needed square terms are \(9\), \(4\), and \(1\). Add all three to both sides:

$$ (x^2-6x+9)+(y^2+4y+4)+(z^2-2z+1)=2+9+4+1=16. $$

Factor each perfect square:

$$ (x-3)^2+(y+2)^2+(z-1)^2=16. $$

The center is \((3,-2,1)\), and the radius is \(\sqrt{16}=4\).

Check by substituting the point \((7,-2,1)\), which is four units from the center. In the original left-hand side, the terms evaluate to \(49+4+1-42-8-2-2=0\). The point satisfies the original equation.

Worked Example: Normalize Before Completing Squares

Find the center and radius of \(4x^2+4y^2+4z^2+8x-16y+24z+40=0\).

All terms have a common factor of \(4\). Divide both sides by \(4\):

$$ x^2+y^2+z^2+2x-4y+6z+10=0. $$

Move the constant to the right and group the coordinate terms:

$$ (x^2+2x)+(y^2-4y)+(z^2+6z)=-10. $$

Half of each linear coefficient is \(1\), \(-2\), and \(3\); their squares are \(1\), \(4\), and \(9\). Add those values to both sides:

$$ (x^2+2x+1)+(y^2-4y+4)+(z^2+6z+9) =-10+1+4+9=4. $$

Thus

$$ (x+1)^2+(y-2)^2+(z+3)^2=4. $$

The center is \((-1,2,-3)\), and the radius is \(\sqrt{4}=2\).

Check with the point \((1,2,-3)\), which is two units from the center. Substitution into the original left-hand side gives \(4+16+36+8-32-72+40=0\). The original equation is satisfied.

Worked Example: An Equation with No Real Points

Determine whether \(x^2+y^2+z^2+2x-4y+6z+20=0\) has any real points.

Move the constant and group terms:

$$ (x^2+2x)+(y^2-4y)+(z^2+6z)=-20. $$

As in the preceding example, the completing-square values are \(1\), \(4\), and \(9\). Add their sum, \(14\), to both sides:

$$ (x^2+2x+1)+(y^2-4y+4)+(z^2+6z+9)=-20+14=-6. $$

Therefore,

$$ (x+1)^2+(y-2)^2+(z+3)^2=-6. $$

The left side is nonnegative for all real \(x,y,z\), while the right side is negative. No real values can satisfy this equation, so it has no real points.

Check against the sign test: the normalized equation has \(A=2\), \(B=-4\), \(C=6\), and \(D=20\). Thus \(r^2=(4+16+36)/4-20=14-20=-6\), the same negative value found by completing squares.

Worked Example: The Zero-Radius Case

Describe the set of real points satisfying \(x^2+y^2+z^2-2x+4y-6z+14=0\).

Move the constant to the right and group the coordinate terms:

$$ (x^2-2x)+(y^2+4y)+(z^2-6z)=-14. $$

The half-coefficients are \(-1\), \(2\), and \(-3\); their squares are \(1\), \(4\), and \(9\). Add their sum, \(14\), to both sides:

$$ (x^2-2x+1)+(y^2+4y+4)+(z^2-6z+9)=-14+14=0. $$

Factoring gives

$$ (x-1)^2+(y+2)^2+(z-3)^2=0. $$

Each square must be zero. Hence \(x=1\), \(y=-2\), and \(z=3\). The equation describes just the point \((1,-2,3)\), not a sphere with positive radius.

Check by substitution into the original left-hand side: \(1+4+9-2-8-18+14=0\). The point satisfies the equation.

A Common Completing-Squares Mistake

When completing a square, the added constants must be balanced on the other side of the equation. For example, consider

$$ x^2+y^2+z^2+6x-2y+4z+9=0. $$

Moving \(9\) to the right gives grouped terms equal to \(-9\). Completing the three squares requires adding \(9\), \(1\), and \(4\), whose sum is \(14\). Therefore the right side must become \(-9+14=5\), giving

$$ (x+3)^2+(y-1)^2+(z+2)^2=5. $$

A common error is to write the completed squares but leave the right side at \(-9\). That would claim a sum of squares equals a negative number, contradicting the original equation's actual geometry. The correction is to account for every added square term on both sides. Here the center is \((-3,1,-2)\), and the radius is \(\sqrt{5}\).

A Reliable Procedure

For a normalized general sphere equation, the calculation can be organized into a few checks.

1
Check the quadratic terms.
Confirm that \(x^2\), \(y^2\), and \(z^2\) have equal coefficients and that the equation has no mixed products. If the common squared-term coefficient is nonzero, divide through by it first.
2
Group and complete each square.
For each coordinate, take half its linear coefficient and add the square of that value to both sides.
3
Read the center and classify the result.
Match the completed squares to center-radius form. A positive right side gives the squared radius, zero gives one point, and a negative right side gives no real points.

Why the Completed Form Is Useful

The expanded equation hides the location and size of the sphere among several terms. Center-radius form makes both visible and offers a quick consistency check: the coordinates in the center have the opposite signs from the quantities inside the squared parentheses, and the radius is the positive square root of the right side when that side is positive.

The sign test is equally useful. It prevents an algebraic equation with no real solutions from being mistaken for a sphere, and distinguishes a single point from a genuine sphere. The decisive habit is to track the added constants carefully, then check the final equation by expansion or substitution.

Check Your Understanding

For each question, show the completing-square steps and use the resulting form to justify your conclusion.

  1. Rewrite \(x^2+y^2+z^2+4x-2y+8z-4=0\) in center-radius form. What are the center and radius?
  2. For \(x^2+y^2+z^2-6x+2y-4z+14=0\), does the equation describe a sphere, one point, or no real points?
  3. Why must a sum of three real squares not equal a negative number?
  4. What quantities must be added to complete the square in \(x^2+10x\), and why must those additions also be included on the other side of an equation?
  5. What features of the quadratic terms allow the standard completing-squares method to identify a sphere?