# Find the equation of the sphere $x^2+y^2+z^2-2x-4y+8z=15$

I'm not sure how you get from this:

$x^2+y^2+z^2-2x-4y+8z=15$

To: $(x^2-2x+1) + (y^2-4y+4) + (z^2+8z+16)-1-4-16=15$

How do you get the $1,4,16$?

-
you are adding $1, 4, 16$ at the end of $x^2, y^2, z^2$ and subtracting them at the and to make it equal. – Santosh Linkha Jan 11 '13 at 22:59
The method is called completing the square. If you don't know how to do it at all, doing it three times (one for each squared variable) won't be any easier! – The Chaz 2.0 Jan 11 '13 at 23:01
Ah, I see. Thanks! – user1766888 Jan 11 '13 at 23:05
I went ahead and outlined this specific (and relatively simple) case below. – The Chaz 2.0 Jan 11 '13 at 23:07
Note that your example is actually wrong : – Hurkyl Jan 12 '13 at 2:16

It's grouping like terms and completing the square. For example, if you collect the terms in $x$ you have $x^2 - 2x$, so you want a constant term that will make that a perfect square. Since $(x-1)^2 = x^2 - 2x + 1$, you need a $1$. Similarly for the other two.

In general, if you have $ax^2 + bx$, to complete the square you need to add a constant term of $b^2/4a$, which makes the entire thing equal to $(\sqrt(a) x + \frac{b}{2\sqrt{a}})^2$. You can easily verify this by multiplying it out.

Here, in the first case, you have $a=1, b=-2$, so your constant term is $(-2)^2/(4*1) = 1$.
Similarly, in the second case $a=1,b=-4$, so your constant term is $(-4)^2/(4*1) = 4$.
In the third case, $a=1,b=8$, so your constant term is $8^2/(4*1) = 16$.

Once you've completed the squares, you can simplify the equation to $$(x-1)^2 + (y-2)^2 + (z+4)^2 = 36,$$ which is much neater and more informative than the original form--you can immediately read off the coordinates of the center of the sphere and its radius.

-

When the quadratic coefficient (i.e. the number in front of the $x^2, y^2,$ etc.) is equal to one, you square half of the linear coefficient (i.e. the number in front of the $x, y,$ etc.) to determine what constant to add to both sides of the equation.

In your case, you do this three times:

For $x$, the linear coefficient is $-1$. Half of this is $-1$, which is $1$ when squared. That's where the $1$ comes from.

For $y$, the linear coefficient is $-4$. Half of this is $-2$, which is $4$ when squared.

For $z$, the linear coefficient is $8$. Half of this is $4$, which is $16$ when squared.

-