Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

A Sphere in a Cube


Date: 3/23/96 at 23:6:40
From: "Mark D. Hoblit"
Subject: Help:... Finding Z coord. in a sphere.

I have hit a little snag trying to solve for Z in a little
algebra/geometry problem I am having.

I have a cube of 200x200x200 and a sphere is inside it with a
radius of 100.  I want to be able to put in x and y and using a 
formula get what z is.  A sphere formula looks like this

(x-x.)*(x-x.)+(y-y.)*(y-y.)+(z-z.)*(z-z.) = r*r

or 

x*x+y*y+z*z-2xx.-2yy.-2zz.+x.*x.+y.*y.+z.*z.-r*r = 0

x, y, and z are the points of the sphere
x., y., and z. represents the center coord. of the sphere
r is the radius.

I have substituted in 100 for r, x., y., and z. (the center of the 
sphere would be (100,100,100) and a radius of 100.

I got:

x*x+y*y+z*z-2(100)x-2(100)y-2(100)z+100*100+100*100+100*100-100*100 = 0

Simplified:

x*x+y*y+z*z-200x-200y-200z+20000=0

now I presume I would move all terms that did not have z to one 
side: z*z-200z=-(x*x)-(y*y)+200x+200y-20000

Okay ... now I'm stuck!.. I don't know if I can/should complete 
a square or if I should square root both sides or what.

Please help me, Dr. Math....

I am using this formula to determine z of any given x and y coord. 
I would think that part of the equation will be under a square 
root.  That part of the equation equals a negative number. I 
presume then that would be telling me that there is no Z for the x 
and y I gave - example 0,0 coord. would not be part of the sphere.  
Also there would be a + or - which will tell me both the top z 
coord. and the bottom z coord. example.  If I give the coord. 
x=100,y=100 (center).. the z coords would be 0 and 200 - or 
if I give the coord. x=0 and y=100 (leftmost part of sphere).. 
it would give 2 answers, both being z=100.

Any help would be much appreciated.  It's been a while since I 
last took a math class!

Thank you,
Mark Hoblit


Date: 3/29/96 at 9:20:24
From: Doctor Ken
Subject: Re: Help:... Finding Z coord. in a sphere.

Hello!

Well, your equations are going to be a little messy since your 
sphere is centered at (100,100,100) instead of (0,0,0), but that's 
okay.  The reason you're having trouble finding the Z value given 
the X and Y values is that there will be two Z values for every 
pair (X,Y), as you noted, and formulas don't like to spit out more 
than one value.  But in this case, we can actually work around 
that.

So I'll work with your equation - no, we don't need to complete 
the square, that would be really messy.  All we need is to take a 
square root.  Leave your sphere equation in its original form 
(don't expand it).  Also, the symbol x^2 means "x squared."

Now we have
(x-100)^2 + (y-100)^2 + (z-100)^2 = 10000.

Move the x and y parts to the right side:
(z-100)^2 = 10000 - (x-100)^2 - (y-100)^2

Now take the square root:
z - 100 = Sqrt{10000 - (x-100)^2 - (y-100)^2}

If that number inside the square root is negative, then your 
original x and y didn't make sense (for instance, x = y = 180 
wouldn't work).  Note that this formula gives you the point where 
z > 0.  To get the other solution, put a negative sign in front of 
the square root.

Now we can move the 100 over to the right:
z = 100 + Sqrt{10000 - (x-100)^2 - (y-100)^2}.
And the other solution is 
z = 100 - Sqrt{10000 - (x-100)^2 - (y-100)^2}.

-Doctor Ken,  The Math Forum

    
Associated Topics:
High School Geometry
High School Higher-Dimensional Geometry

Search the Dr. Math Library:


Find items containing (put spaces between keywords):
 
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/