TExcelTAD
Home › Algebra › Other Equations and Their Shapes

Other Equations and Their Shapes

Lines and parabolas are only the start. Equations with x2x^2 and y2y^2 together draw circles, ellipses and hyperbolas, and a few other simple equations give shapes you will meet constantly: the V of absolute value, the half-parabola of a square root, the S of a cube. This lesson teaches you to recognise each shape from its equation and shows where programmers use them.

Circle

A circle is the set of points at distance rr from a centre (h,k)(h, k). The distance formula squared gives its equation:

(x−h)2+(y−k)2=r2(x - h)^2 + (y - k)^2 = r^2

(x−2)2+(y+1)2=9(x - 2)^2 + (y + 1)^2 = 9 is the circle with centre (2,−1)(2, -1) and radius 3. With the centre at the origin it is simply x2+y2=r2x^2 + y^2 = r^2.

If the equation arrives expanded, complete the square in xx and in yy:

x2+y2−4x+2y−4=0(x2−4x+4)+(y2+2y+1)=4+4+1(x−2)2+(y+1)2=9centre (2,−1), radius 3\begin{aligned} &x^2 + y^2 - 4x + 2y - 4 = 0 \\ &(x^2 - 4x + 4) + (y^2 + 2y + 1) = 4 + 4 + 1 \\ &(x - 2)^2 + (y + 1)^2 = 9 && \text{centre } (2, -1),\ \text{radius } 3 \end{aligned}

Ellipse

Stretch a circle by different amounts horizontally and vertically and you get an ellipse. Centred at the origin:

x2a2+y2b2=1x-intercepts (±a,0),y-intercepts (0,±b)\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1 \qquad x\text{-intercepts } (\pm a, 0),\quad y\text{-intercepts } (0, \pm b)

x216+y29=1\frac{x^2}{16} + \frac{y^2}{9} = 1 is 8 wide (from −4-4 to 4) and 6 tall (from −3-3 to 3). When a=ba = b it is a circle. Planetary orbits are ellipses, and so is a circle seen at an angle, which is why a round plate looks elliptical in a perspective drawing.

Hyperbola

Change the plus to a minus and the curve splits into two branches that open away from each other:

x2a2−y2b2=1vertices (±a,0),asymptotes y=±ba⋅x\frac{x^2}{a^2} - \frac{y^2}{b^2} = 1 \qquad \text{vertices } (\pm a, 0),\quad \text{asymptotes } y = \pm\frac{b}{a} \cdot x

x24−y29=1\frac{x^2}{4} - \frac{y^2}{9} = 1 has vertices (±2,0)(\pm 2, 0) and approaches the lines y=±1.5xy = \pm 1.5x without touching them. The curve y=1xy = \frac{1}{x} (or xy=1xy = 1) is also a hyperbola, rotated by 45°; it is the graph of inverse variation, "double one quantity, halve the other".

python · try it yourself
import numpy as np
import matplotlib.pyplot as plt

t = np.linspace(0, 2 * np.pi, 300)
s = np.linspace(-2, 2, 200)
fig, axes = plt.subplots(1, 3, figsize=(10, 3.4))

axes[0].plot(2 + 3 * np.cos(t), -1 + 3 * np.sin(t))
axes[0].plot(2, -1, "k+"); axes[0].set_title("(x − 2)² + (y + 1)² = 9")

axes[1].plot(4 * np.cos(t), 3 * np.sin(t))
axes[1].set_title("x²/16 + y²/9 = 1")

for sign in (1, -1):                           # two branches: x = ±2·cosh(s)
    axes[2].plot(sign * 2 * np.cosh(s), 3 * np.sinh(s), color="tab:blue")
xs = np.linspace(-6, 6, 2)
axes[2].plot(xs, 1.5 * xs, "--", color="gray"); axes[2].plot(xs, -1.5 * xs, "--", color="gray")
axes[2].set_ylim(-8, 8); axes[2].set_title("x²/4 − y²/9 = 1")

for ax in axes:
    ax.axhline(0, color="black", linewidth=0.6); ax.axvline(0, color="black", linewidth=0.6)
    ax.set_aspect("equal", adjustable="datalim"); ax.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()
print("circle, ellipse and hyperbola (with its asymptotes)")
circle, ellipse and hyperbola (with its asymptotes)

The figure draws the curves with parametric formulas (x=4cos⁡tx = 4\cos t, y=3sin⁡ty = 3\sin t for the ellipse), which avoids solving for yy and handling the ±\pm of a square root. Parametric curves are covered in Pre-Calculus and in Parametric Curves.

Recognising the shape

For an equation Ax2+Cy2+Dx+Ey+F=0Ax^2 + Cy^2 + Dx + Ey + F = 0 (no xyxy term), the squared terms decide the shape:

Squared terms Shape Example
only one of x2x^2 or y2y^2 parabola y=x2−3y = x^2 - 3, x=y2x = y^2
x2x^2 and y2y^2, same sign, A=CA = C circle x2+y2=25x^2 + y^2 = 25
x2x^2 and y2y^2, same sign, A≠CA \ne C ellipse 4x2+9y2=364x^2 + 9y^2 = 36
x2x^2 and y2y^2, opposite signs hyperbola x2−4y2=4x^2 - 4y^2 = 4

Together these four curves are the conic sections: each is the outline you get by slicing a cone with a plane (Conic Sections). A few other basic shapes complete the catalogue:

Equation Shape
y=∣x∣y = \lvert x \rvert a V with its corner at the origin
y=xy = \sqrt{x} the upper half of a sideways parabola, starting at (0,0)(0, 0)
y=x3y = x^3 an S-shaped curve through the origin, low on the left and high on the right
y=1xy = \frac{1}{x} a hyperbola in quadrants I and III
python · try it yourself
def classify(A, C):
    """Shape of A·x² + C·y² + D·x + E·y + F = 0 (no xy term, non-degenerate)."""
    if A == 0 or C == 0:
        return "parabola"
    if A * C < 0:
        return "hyperbola"
    return "circle" if A == C else "ellipse"

examples = {"x² + y² = 25": (1, 1), "4x² + 9y² = 36": (4, 9),
            "x² − 4y² = 4": (1, -4), "y = x² − 3": (1, 0), "x² + y² − 4x + 2y − 4 = 0": (1, 1)}
for eq, (A, C) in examples.items():
    print(f"{eq:28} -> {classify(A, C)}")
x² + y² = 25                 -> circle
4x² + 9y² = 36               -> ellipse
x² − 4y² = 4                 -> hyperbola
y = x² − 3                   -> parabola
x² + y² − 4x + 2y − 4 = 0    -> circle

("Non-degenerate" excludes special cases such as x2+y2=0x^2 + y^2 = 0, a single point, or x2+y2=−1x^2 + y^2 = -1, which has no points at all.)

In software

  • Circle tests. "Is the enemy inside the explosion radius?" is (x−h)2+(y−k)2≤r2(x - h)^2 + (y - k)^2 \le r^2. Games compare the squared distance with r2r^2 to skip the square root (Circles and Spheres).
  • Ellipse tests. An oval button, an elliptical vision cone or a stretched hit area uses (xa)2+(yb)2≤1(\frac{x}{a})^2 + (\frac{y}{b})^2 \le 1 after shifting to the ellipse's centre.
  • Hyperbolas. On-screen size is proportional to 1distance\frac{1}{\text{distance}}, a hyperbola, which is why a perspective camera divides by depth. GPS and sound-source location also use hyperbolas: a fixed difference of distances to two receivers puts the source on a hyperbola.
python · try it yourself
def in_ellipse(x, y, a, b, cx=0, cy=0):
    return ((x - cx) / a) ** 2 + ((y - cy) / b) ** 2 <= 1

def in_circle(x, y, cx, cy, r):
    return (x - cx) ** 2 + (y - cy) ** 2 <= r * r     # no square root needed

print(in_ellipse(2, 1.5, 4, 3), in_ellipse(3.5, 2, 4, 3))
print(in_circle(4, 1, 2, -1, 3), in_circle(5, 1, 2, -1, 3))
True False
True False

(2,1.5)(2, 1.5) gives 0.25+0.25=0.5≤10.25 + 0.25 = 0.5 \le 1, inside the ellipse; (3.5,2)(3.5, 2) gives about 1.21, outside. For the circle, (4,1)(4, 1) is at squared distance 8≤98 \le 9, while (5,1)(5, 1) is at 13>913 > 9.

Exercises

Exercise 1: Read a circle

Give the centre and radius of (x+3)2+(y−4)2=25(x + 3)^2 + (y - 4)^2 = 25. Does the circle pass through the origin?

Answer

Centre (−3,4)(-3, 4), radius 5; yes, it passes through the origin.

Solution
(x−(−3))2+(y−4)2=52  →  centre (−3,4), r=5origin: (0+3)2+(0−4)2=9+16=25 ✓\begin{aligned} &(x - (-3))^2 + (y - 4)^2 = 5^2 \;\to\; \text{centre } (-3, 4),\ r = 5 \\ &\text{origin: } (0 + 3)^2 + (0 - 4)^2 = 9 + 16 = 25\ \checkmark \end{aligned}

Exercise 2: Complete the squares

Find the centre and radius of x2+y2−2x+6y+6=0x^2 + y^2 - 2x + 6y + 6 = 0.

Answer

Centre (1,−3)(1, -3), radius 2.

Solution
(x2−2x+1)+(y2+6y+9)=−6+1+9(x−1)2+(y+3)2=4\begin{aligned} (x^2 - 2x + 1) + (y^2 + 6y + 9) &= -6 + 1 + 9 \\ (x - 1)^2 + (y + 3)^2 &= 4 \end{aligned}
python · try it yourself
from sympy import symbols, expand
x, y = symbols("x y")
print(expand((x - 1)**2 + (y + 3)**2 - 4))
x**2 - 2*x + y**2 + 6*y + 6

Exercise 3: An ellipse

Identify 4x2+9y2=364x^2 + 9y^2 = 36 and give its intercepts.

Answer

An ellipse, x29+y24=1\frac{x^2}{9} + \frac{y^2}{4} = 1, with intercepts (±3,0)(\pm 3, 0) and (0,±2)(0, \pm 2).

Solution

Both squared terms are positive with different coefficients, so it is an ellipse. Divide by 36:

4x236+9y236=1  →  x29+y24=1a=3, b=2\begin{aligned} &\frac{4x^2}{36} + \frac{9y^2}{36} = 1 \;\to\; \frac{x^2}{9} + \frac{y^2}{4} = 1 \\ &a = 3,\ b = 2 \end{aligned}

Exercise 4: A hyperbola

Identify x2−4y2=4x^2 - 4y^2 = 4. Give its vertices and asymptotes.

Answer

A hyperbola, x24−y2=1\frac{x^2}{4} - y^2 = 1, with vertices (±2,0)(\pm 2, 0) and asymptotes y=±x2y = \pm\frac{x}{2}.

Solution
divide by 4: x24−y21=1  →  a=2, b=1vertices (±2,0),asymptotes y=±bax=±x2\begin{aligned} &\text{divide by 4: } \frac{x^2}{4} - \frac{y^2}{1} = 1 \;\to\; a = 2,\ b = 1 \\ &\text{vertices } (\pm 2, 0),\quad \text{asymptotes } y = \pm\frac{b}{a}x = \pm\frac{x}{2} \end{aligned}

Exercise 5: Explosion radius

An explosion at (10,6)(10, 6) has radius 5. Which of the enemies at (13,10)(13, 10), (14,9)(14, 9) and (6,2)(6, 2) are hit? Answer by comparing squared distances in code.

Answer

(13,10)(13, 10) and (14,9)(14, 9) are hit; (6,2)(6, 2) is not.

Solution
(13,10):32+42=25≤25hit (exactly on the edge)(14,9):42+32=25≤25hit(6,2):42+42=32>25miss\begin{aligned} (13, 10)&: \quad 3^2 + 4^2 = 25 \le 25 && \text{hit (exactly on the edge)} \\ (14, 9)&: \quad 4^2 + 3^2 = 25 \le 25 && \text{hit} \\ (6, 2)&: \quad 4^2 + 4^2 = 32 > 25 && \text{miss} \end{aligned}
python · try it yourself
cx, cy, r = 10, 6, 5
for ex, ey in [(13, 10), (14, 9), (6, 2)]:
    d2 = (ex - cx) ** 2 + (ey - cy) ** 2
    print((ex, ey), d2, "hit" if d2 <= r * r else "miss")
(13, 10) 25 hit
(14, 9) 25 hit
(6, 2) 32 miss

Test yourself

What shape is 3x2+3y2=123x^2 + 3y^2 = 12?

  1. Ellipse
  2. Circle with radius 2
  3. Hyperbola
  4. Parabola

Which equation describes a hyperbola?

  1. x29+y24=1\frac{x^2}{9} + \frac{y^2}{4} = 1
  2. y=2x2+1y = 2x^2 + 1
  3. x29−y24=1\frac{x^2}{9} - \frac{y^2}{4} = 1
  4. x2+y2=9x^2 + y^2 = 9

Why do games test (x−h)2+(y−k)2≤r2(x - h)^2 + (y - k)^2 \le r^2 instead of comparing the distance with rr?

  1. It is more accurate for large circles
  2. It avoids computing a square root and gives the same answer
  3. Distances can be negative
  4. It works only for ellipses