Equation of a Sphere Calculator
Enter a center point and radius, two endpoints of a diameter, or the expanded-form coefficients to find the standard and general equation of any sphere instantly. Results include the full equation in both forms, radius, diameter, surface area, volume, great-circle circumference, and a step-by-step derivation showing every conversion.
What is the equation of a sphere?
A sphere in three-dimensional space is the set of all points that are the same distance (the radius r) from a fixed point called the center. If the center has coordinates (h, k, l), then any point (x, y, z) lies on the sphere when the distance from that point to the center equals r. Applying the distance formula gives the standard equation: (x-h)^2 + (y-k)^2 + (z-l)^2 = r^2. When the center is the origin (0,0,0) this simplifies to x^2 + y^2 + z^2 = r^2. Expanding the squares and collecting terms yields the general form x^2 + y^2 + z^2 + Dx + Ey + Fz + G = 0, where D = -2h, E = -2k, F = -2l, and G = h^2 + k^2 + l^2 - r^2.
How to use this calculator
Three input modes cover the most common ways a sphere is described. In center-radius mode, enter the coordinates (h, k, l) of the center and the radius r directly. In diameter-endpoints mode, enter two points that are the ends of a diameter: the calculator finds the center as the midpoint and the radius as half the distance between the points. In expanded-form mode, supply the coefficients D, E, F, G from the general equation x^2 + y^2 + z^2 + Dx + Ey + Fz + G = 0: the calculator completes the square on all three variables to recover the center and radius. All modes output the standard equation, the general equation, and all standard sphere measurements.
Converting between standard and general form
Going from standard to general form is purely algebraic: expand each squared term, collect like terms, and group all constants on one side. For example, (x-2)^2 + (y+3)^2 + (z-5)^2 = 16 expands to x^2 - 4x + 4 + y^2 + 6y + 9 + z^2 - 10z + 25 = 16, then rearranging gives x^2 + y^2 + z^2 - 4x + 6y - 10z + 22 = 0. Going the other direction requires completing the square: for each linear term Dx, add and subtract (D/2)^2. The radius squared equals (D/2)^2 + (E/2)^2 + (F/2)^2 - G; if this value is negative, the coefficients do not represent a real sphere.
Finding a sphere from two diameter endpoints
If you know two points that are the opposite ends of a diameter, you can find the sphere equation without knowing the center or radius separately. The center is the midpoint of the segment: h = (x1+x2)/2, k = (y1+y2)/2, l = (z1+z2)/2. The radius is half the length of the segment: r = (1/2) * sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2). For example, endpoints (1,2,3) and (5,-4,7) give center (3,-1,5) and radius = (1/2)*sqrt(16+36+16) = (1/2)*sqrt(68) = sqrt(17), so the standard equation is (x-3)^2 + (y+1)^2 + (z-5)^2 = 17.
Surface area and volume of a sphere
Once the radius is known, two important measurements follow. Surface area is 4*pi*r^2, the total area of the outer shell. Volume is (4/3)*pi*r^3, the space enclosed inside. Both grow quickly with radius: doubling the radius increases surface area by a factor of four and volume by a factor of eight. The great-circle circumference, 2*pi*r, is the circumference of any cross-section that passes through the center, and equals the circumference of a circle with the same radius as the sphere.
Sphere equation forms at a glance
| Form | Expression | Usage |
|---|---|---|
| Standard | (x-h)^2 + (y-k)^2 + (z-l)^2 = r^2 | Identifies center and radius directly |
| General | x^2 + y^2 + z^2 + Dx + Ey + Fz + G = 0 | Expanded polynomial form; complete the square to convert |
| Surface area | 4*pi*r^2 | Total area of the spherical surface |
| Volume | (4/3)*pi*r^3 | Space enclosed by the sphere |
| Diameter | d = 2r | Distance across the sphere through the center |
| Great-circle circumference | C = 2*pi*r | Circumference of the largest cross-section |
| Midpoint / center from diameter | ((x1+x2)/2, (y1+y2)/2, (z1+z2)/2) | Center when two diameter endpoints are known |
| Radius from diameter endpoints | r = (1/2)*sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2) | Distance formula halved |
Key formulas for a sphere with center (h, k, l) and radius r.
Frequently asked questions
What is the standard equation of a sphere?
The standard equation is (x-h)^2 + (y-k)^2 + (z-l)^2 = r^2, where (h, k, l) is the center and r is the radius. Every point (x, y, z) that satisfies this equation lies exactly on the surface of the sphere. If the center is at the origin the equation reduces to x^2 + y^2 + z^2 = r^2.
How do I convert the general form to standard form?
Complete the square on each variable. For x^2 + Dx, add (D/2)^2 to both sides to get (x + D/2)^2. Do the same for y and z with E and F. The radius squared is then r^2 = (D/2)^2 + (E/2)^2 + (F/2)^2 - G. If r^2 turns out to be zero the equation describes a single point; if it is negative there is no real sphere.
How do I find the equation of a sphere given two endpoints of a diameter?
Find the center as the midpoint: h = (x1+x2)/2, k = (y1+y2)/2, l = (z1+z2)/2. Find the radius as half the distance: r = (1/2)*sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2). Then substitute h, k, l, and r into the standard form.
How do I check if a point lies inside or outside a sphere?
Substitute the point (x0, y0, z0) into the left side of the standard equation: compute d^2 = (x0-h)^2 + (y0-k)^2 + (z0-l)^2. If d^2 < r^2 the point is inside the sphere; if d^2 = r^2 it is on the surface; if d^2 > r^2 it is outside.
What does the general form tell me that the standard form does not?
The general form x^2 + y^2 + z^2 + Dx + Ey + Fz + G = 0 appears when expanding or simplifying algebraic expressions, and it is the form typically produced by a system of equations. It is harder to read directly, but converting it to standard form immediately reveals the center and radius. The standard form is the more useful geometric representation.
Can a sphere have a negative radius?
No. The radius is a distance and must be a positive real number. If completing the square yields a negative value for r^2, the given equation has no real-number solutions and does not represent any sphere in three-dimensional space.