Analytic Geometry Formulas

All Formulas: Contents || Ask Dr. Math || Dr. Math FAQ || Search Dr. Math

Two Dimensions

The most commonly used coordinate system in two dimensions is the Cartesian or rectangular coordinate system described below. Another system seen fairly often is the polar coordinate system.

```                                         ^ y
|
|
2+
|
*- - - - - - - * P(x,y)
|       x      .
1+              .
|y            y.
|              .
|       x      .
-----+-----+-----+-----+-----+-----+--*--+-----> x
-3    -2    -1    0|     1     2     3
|
|
-1+
|
|
|
-2+|
|
|```

[
Back to Analytic Geometry Formula Contents]

### Two dimensions: Points

A point is specified by an ordered pair of numbers called its coordinates. Let the coordinates of P1 be (x1,y1), those of P2 be (x2,y2), and those of P3 be (x3,y3).

The distance from P1 to P2 is

d = sqrt[(x1-x2)2+ (y1-y2)2].

The coordinates of the point dividing the line segment P1P2 in the ratio r/s are:

([r x2+s x1]/[r+s], [r y2+s y1]/[r+s]).

As a special case, when r = s, the midpoint of the line segment has coordinates

([x2+x1]/2,[y2+y1]/2).

P1, P2, and P3 are collinear if and only if the determinant

 x1 y1 1 = 0. x2 y2 1 x3 y3 1

[ Back to Analytic Geometry Formula Contents]

### Two dimensions: Directions

A direction is determined by an ordered pair of two numbers (a,b), not both zero, called direction numbers. The direction corresponds to all lines parallel to the line through the origin (0,0) and the point (a,b). The direction numbers (a,b) and the direction numbers (ra,rb) determine the same direction, for any nonzero r.

We pick an r in the following way.

|r| = 1/sqrt(a2+b2).
If a is nonzero, the sign of r is the same as the sign of a. If a = 0 and b is nonzero, the sign of r is the same as the sign of b. This means that the first nonzero number in (ra,rb) is positive.

With this choice of r, the direction numbers (ra,rb) are just the cosines of the angles that the line makes with the positive x-, and y-axes. These angles alpha and beta, respectively, are called the direction angles, and their cosines (cos[alpha],cos[beta]) are called the direction cosines of that direction. They satisfy

cos2[alpha] + cos2[beta] = 1.
Since alpha + beta = Pi/2, and cos[beta] = sin[alpha], beta is superfluous and usually not used. The angle alpha is called the inclination of the direction, and m = tan[alpha] = b/a is called the slope of the direction.

In this context, we can think of the possibility of infinite slope, which occurs if the direction cosines are (0,1), and the inclination is Pi/2, so the direction is vertical. We interpret 1/m to be 0 in that case.

Two directions are parallel if and only if any of the following relations hold:

alpha1 = alpha2,
m1 = m2,
 a1 b1 = 0. a2 b2

Two directions are perpendicular if and only if

|alpha1-alpha2| = Pi/2,
m1m2 = -1,
a1a2 + b1b2 = 0.

The angle between two directions is given by

alpha1 - alpha2 = arctan([m1-m2]/[1+m1m2]) = arctan([a2b1-a1b2]/[a1a2+b1b2]).

The direction perpendicular to a given direction (a1,b1) has direction numbers (b1,-a1).

Two points P1 and P2 determine a direction with direction numbers (x2-x1,y2-y1). The slope of that direction is

m = (y2-y1)/(x2-x1).

[ Back to Analytic Geometry Formula Contents]

### Two dimensions: Lines

A line is the set of all points with coordinates (x,y) which satisfy an equation of degree 1 in x and y, that is, a linear equation.

Let the slope of the line be m, its intersection with the x-axis be (a,0), its intersection with the y-axis be (0,b), its perpendicular distance from the origin be p, its inclination be alpha, and the inclination of any line perpendicular to it be omega. Then tan(alpha) = m = -b/a (if a is not zero), and omega = alpha ± Pi/2.

The equation of a line can have any of several forms:

• Slope y-intercept form:

y = m x + b, if m is finite.
• Two point form:

(x-x1)(y2-y1) = (y-y1)(x2-x1).
• Point slope form:

y - y1 = m(x-x1), if m is finite.
• Intercept form:

x/a + y/b = 1, if neither a nor b is zero.
• Normal form:

x cos(omega) + y sin(omega) = p.
• Parametric form:

x = x1 + t cos(alpha),
y = y1 + t sin(alpha),
where t is any real number.

• Point direction form:

(x-x1)/A = (y-y1)/B,
where (A,B) is the direction of the line and P1 lies on the line.

• General form:

A x + B y + C = 0,
where A, B, and C are real numbers, and not both A and B are zero.

The distance from Ax + By + C = 0 to P1 is

d = |Ax1+By1+C|/sqrt(A2+B2).

If A1x + B1y + C1 = 0 and A2x + B2y + C2 = 0 are two lines, then their slopes are given by m1 = -A1/B1 and m2 = -A2/B2.

If they intersect, their intersection point has coordinates

x = (-C1B2+C2B1)/(A1B2-A2B1), y = (-A1C2+A2C1)/(A1B2-A2B1).

Three lines

A1x + B1y + C1 = 0,
A2x + B2y + C2 = 0,
A3x + B3y + C3 = 0,

are concurrent (that is, all pass through a single point) if and only if the determinant

 A1 B1 C1 = 0. A2 B2 C2 A3 B3 C3

The perpendicular bisector of the line segment P1P2 has the equation

(x2-x1)x + (y2-y1)y - [(x22+y22) - (x12+y12)]/2 = 0.

A line segment P1P2 can be represented in parametric form by

x = x1 + (x2-x1)t,
y = y1 + (y2-y1)t,
0 <= t <= 1.

Two line segments P1P2 and P3P4 intersect if any only if the solution (s,t) of the two simultaneous equations

x1 + (x2-x1)t = x3 + (x4-x3)s,
y1 + (y2-y1)t = y3 + (y4-y3)s,

which are

 s = x2–x1 y2–y1 , x3–x1 y3–y1 x2–x1 y2–y1 x3–x4 y3–y4

 t = x3–x1 y3–y1 , x3–x4 y3–y4 x2–x1 y2–y1 x3–x4 y3–y4

satisfy 0 <= s <= 1 and 0 <= t <= 1.

[ Back to Analytic Geometry Formula Contents]

### Two dimensions: Triangles

The area of the triangle formed by the three lines

A1x + B1y + C1 = 0,
A2x + B2y + C2 = 0,
A3x + B3y + C3 = 0,

is given by

 A1 B1 C1 2 A2 B2 C2 A3 B3 C3
K =
.
2
 A1 B1 A2 B2
 A2 B2 A3 B3
 A3 B3 A1 B1

The area of a triangle whose vertices are P1, P2, and P3 is given by the determinants

 K = (1/2) x1 y1 1 , x2 y2 1 x3 y3 1

 K = (1/2) x2–x1 y2–y1 . x3–x1 y3–y1

The centroid (intersection of the medians, or center of gravity) of the same triangle has coordinates

x = (x1+x2+x3)/3, y = (y1+y2+y3)/3.

The incenter (intersection of the angle bisectors) of the same triangle has coordinates

x = (ax1+bx2+cx3)/(a+b+c), y = (ay1+by2+cy3)/(a+b+c),

where a is the length of P2P3, b is the length of P3P1, and c is the length of P1P2.

The circumcenter (intersection of the side perpendicular bisectors) of the same triangle has coordinates

 x12+y12 y1 1 x22+y22 y2 1 x32+y32 y3 1
 x1 x12+y12 1 x2 x22+y22 1 x3 x32+y32 1
x =
,   y =
.
 2 x1 y1 1 x2 y2 1 x3 y3 1
 2 x1 y1 1 x2 y2 1 x3 y3 1

The orthocenter (intersection of the altitudes) of the same triangle has coordinates

 y1 x2x3+y12 1 y2 x3x1+y22 1 y3 x1x2+y32 1
 x12+y2y3 x1 1 x22+y3y1 x2 1 x32+y1y2 x3 1
x =
,   y =
.
 x1 y1 1 x2 y2 1 x3 y3 1
 x1 y1 1 x2 y2 1 x3 y3 1

To determine if P0 = (x0,y0) is inside, on, or outside of a given triangle P1P2P3, solve the following three linear equations for the three unknowns r, s, and t:

 x0 y0 1 x2 y2 1 x3 y3 1
 x1 y1 1 x0 y0 1 x3 y3 1
 x1 y1 1 x2 y2 1 x0 y0 1
r =
,    s =
,    t =
.
 x1 y1 1 x2 y2 1 x3 y3 1
 x1 y1 1 x2 y2 1 x3 y3 1
 x1 y1 1 x2 y2 1 x3 y3 1

(1) If 0 < r < 1, 0 < s < 1, 0 < t < 1, then P0 is properly inside the triangle.

(2) If 0 <= r <= 1, 0 <= s <= 1, 0 <= t <= 1, and one or two of r, s, and t is zero, then P0 is on the triangle's boundary (one zero means edge, two zeroes means vertex).

(3) If any of the inequalities in (2) above is false, P0 is outside the triangle.

[ Back to Analytic Geometry Formula Contents]

### Two dimensions: Polygons

The area of a polygon whose vertices are P1, P2, .., Pn is given by the expression

K = [(x1y2 + x2y3 + x3y4 + ... + xny1) - (x2y1 + x3y2 + x4y3 + ... + x1yn)]/2.

[ Back to Analytic Geometry Formula Contents]

### Two dimensions: Conic Sections

A conic section is the set of points P in a plane determined by a line D (a directrix) and a point F (a focus) not on D, such that the ratio of distances PF/PD = e (the eccentricity). A vertex is a point where the distances PF and PD are least. An axis is the line through F perpendicular to D. The latus rectum is the distance between those two points on the curve which also lie on a line through F parallel to D.

The value of e determines what kind of curve the conic section forms:

1. e > 1, an hyperbola.
2. e = 1, a parabola.
3. e < 1, an ellipse.

If F has coordinates (0,0), and D has equation x = -a, then the equation of the conic section is

x2 + y2 = e2(x+a)2.

A vertex has coordinates (-ae/[1+e],0), and an axis has equation y = 0. Note that the equation of a conic section is always a quadratic equation.

[ Back to Analytic Geometry Formula Contents]

#### Two dimensions: Hyperbolas

The line segment connecting the two vertices, which lies on the axis, is called the transverse axis, and has length 2a. Its midpoint is the center of the hyperbola. Perpendicular to the transverse axis at the midpoint is the conjugate axis, whose length is 2b. The eccentricity is e = sqrt(a2+b2)/a. The distance from the center to either of the two foci is ae. The distance from a vertex to the nearest focus is a(e-1). The distance from the center to either of the two directrices is a/e. The length of the latus rectum is 2b2/a.

The absolute value of the difference of the distances from any point on the hyperbola to the two foci is 2a.

The equation of the hyperbola has one of the following forms:

• General form:

Ax2 + Bxy + Cy2 + Dx + Ey + F = 0,

where B2-4AC > 0.

• General form with axes parallel to the coordinate axes:

Ax2 + Cy2 + Dx + Ey + F = 0,

where AC < 0.

• Standard form:

(x-h)2/a2 - (y-k)2/b2 = 1.

In this form, the center has coordinates (h,k), the transverse axis has equation y = k, the conjugate axis has equation x = h, the directrices have equations x = h + a/e and x = h - a/e, and the asymptotes have equations a(y-k) ± b(x-h) = 0. The latus rectum has length 2b2/a. The tangent to the hyperbola at P1 has equation

(x-h)(x1-h)/a2 - (y-k)(y1-k)/b2 = 1.
The normal to the hyperbola at P1 has equation
b2(y-y1)(x1-h) = -a2(x-x1)(y1-k).

• Asymptotic form:

xy = e2/4.

In this form, the center is the origin, a = b = e/sqrt(2), the foci have coordinates (a,a) and (-a,-a), the transverse axis has equation y = x, the conjugate axis has equation y = -x, and the asymptotes have equations x = 0 and y = 0.

[
Back to Analytic Geometry Formula Contents]

#### Two dimensions: Parabolas

The distance from the vertex to F is p = a/2. The distance from the vertex to D is p. The length of the latus rectum is 4p.

The equation of the parabola can be put into any of the following forms:

• Standard form:

x2 = 4py.

In this form the vertex is the origin, F has coordinates (0,p), and D has equation y = -p.

• Vertex form:

(x-h)2 = 4p(y-k),

In this form the vertex has coordinates (h,k), F has coordinates (h,k+p), and D has equation y = k-p. The length of the latus rectum of the parabola is 4p. The tangent to the parabola at P1 has equation

2p(y-y1) = (x1-h)(x-x1).

The normal to the parabola at P1 has equation

2p(x-x1) = (h-x1)(y-y1).

• General form:

Ax2 + Bxy + Cy2 + Dx + Ey + F = 0,

where B2-4AC = 0, and not all of A, B, and C are zero.

• General form, axis parallel to the x-axis:

Cy2 + Dx + Ey + F = 0 (C, D nonzero),
x = ay2 + by + c (a nonzero).

• General form, axis parallel to the y-axis:

Ax2 + Dx + Ey + F = 0 (A, E nonzero),
y = ax2 + bx + c (a nonzero).

[
Back to Analytic Geometry Formula Contents]

#### Two dimensions: Ellipses

The line segment connecting the two vertices, which lies on the axis, is called the major axis, and has length 2a. Its midpoint is the center of the ellipse. Perpendicular to the major axis at the center is the minor axis, whose length is 2b. The eccentricity is e = sqrt(a2-b2)/a < 1. The distance from the center to either of the two foci is ae. The distance from a vertex to the nearest focus is a(1-e). The distance from the center to either of the two directrices is a/e. The length of the latus rectum is 2b2/a.

The sum of the distances from any point on the ellipse to the two foci is 2a.

The equation of the ellipse has one of the following forms:

• General form:

Ax2 + Bxy + Cy2 + Dx + Ey + F = 0,

where B2-4AC < 0.

• General form with axes parallel to the coordinate axes:

Ax2 + Cy2 + Dx + Ey + F = 0,

where AC > 0.

• Standard form:

(x-h)2/a2 + (y-k)2/b2 = 1 (b <= a).

In this form, the center has coordinates (h,k), the major axis has equation y = k, the minor axis has equation x = h, and the directrices have equations x = h + a/e and x = h - a/e. The latus rectum has length 2b2/a. The tangent to the ellipse at P1 has equation

(x-h)(x1-h)/a2 + (y-k)(y1-k)/b2 = 1.

The normal to the ellipse at P1 has equation

b2(y-y1)(x1-h) = a2(x-x1)(y1-k).

[
Back to Analytic Geometry Formula Contents]

#### Two dimensions: Circles

A circle is an ellipse with e = 0, a = b = r, coincident foci, and directrices at infinity. Its equation can take any one of the following forms:

(x-h)2 + (y-k)2 = r2 (r > 0).

The equation of the tangent to this circle at P1 has equation

(x-h)(x1-h) + (y-k)(y1-k) = r2.

The equation of the normal to this circle at P1 has equation

(y-y1)(x1-h) = (x-x1)(y1-k).

• General form:

A x2 + A y2 + D x + E y + F = 0 (A nonzero, D2 + E2 > 4AF).

Then the center of the circle has coordinates (h,k), where h = -D/(2A), k = -E/(2A), and the radius of the circle is r = sqrt(D2+E2-4AF)/(2|A|) > 0.

• Diameter form, where P1 and P2 are the endpoints of a diameter:

(x-x1)(x-x2) + (y-y1)(y-y2) = 0.

• Three point form, where P1, P2, and P3 lie on the circle:

 x2+y2 x y 1 = 0. x12+y12 x1 y1 1 x22+y22 x2 y2 1 x32+y32 x3 y3 1

• Parametric form:

x = r cos(t), y = r sin(t), 0 <= t < 2 Pi.

The center of gravity of a sector of a circle with radius r and central angle theta lies on the bisector of the central angle, and its distance from the center is

4 r sin(theta/2)/(3 theta).

The center of gravity of a segment of a circle with radius r and central angle theta lies on the bisector of the central angle, and its distance from the center is

4 r sin3(theta/2)/(3[theta-sin(theta)]).

A circle (x-x1)2 + (y-y1)2 = r2 and a line Ax + By + C = 0 are tangent if and only if

Delta = r2(A2+B2) - (Ax1+By1+C)2 = 0.

The line and circle do not intersect if Delta < 0, and they intersect in two points if Delta > 0. In the latter case, the two points of intersection have coordinates

x = (B2x1-ABy1-AC+B sqrt[Delta])/(A2+B2),
y = (A2y1-ABx1-BC-A sqrt[Delta])/(A2+B2)     and

x = (B2x1-ABy1-AC-B sqrt[Delta])/(A2+B2),
y = (A2y1-ABx1-BC+A sqrt[Delta])/(A2+B2).

Two circles with centers at P1 and P2 and radii r1 and r2 are externally tangent if and only if

(x1-x2)2 + (y1-y2)2 = (r1+r2)2.

The same two circles are internally tangent if and only if

(x1-x2)2 + (y1-y2)2 = (r1-r2)2.

The common chord or common tangent of the two circles has equation

2(x2-x1)x + 2(y2-y1)y + x12 - x22 + y12 - y22 - r12 + r22 = 0.

The coordinates of the point(s) of intersection of the two circles are

```   x = (-[x1-x2][r12-r22-x12+x22]+[x1+x2][y1-y2]2+[y1-y2]sqrt[Delta])/(2[x1-x2]2+2[y1-y2]2),
y = (-[y1-y2][r12-r22-y12+y22]+[y1+y2][x1-x2]2-[x1-x2]sqrt[Delta])/(2[x1-x2]2+2[y1-y2]2),

and

x = (-[x1-x2][r12-r22-x12+x22]+[x1+x2][y1-y2]2-[y1-y2]sqrt[Delta])/(2[x1-x2]2+2[y1-y2]2),
y = (-[y1-y2][r12-r22-y12+y22]+[y1+y2][x1-x2]2+[x1-x2]sqrt[Delta])/(2[x1-x2]2+2[y1-y2]2),

where

Delta = -([x1-x2]2+[y1-y2]2-[r1-r2]2)([x1-x2]2+[y1-y2]2-[r1+r2]2).

```
The equations of the two lines tangent to a circle with center at P1 and radius r from an outside point P2 are
```   ([x1-x2][y1-y2] ± r sqrt[(x1-x2)2+(y1-y2)2-r2])(x-x2) + (r2-[x1-x2]2)(y-y2) = 0.
```

[
Back to Analytic Geometry Formula Contents]

A general quadratic equation can be put into the following form:

ax2 + 2bxy + cy2 + 2dx + 2ey + f = 0.

If we have an equation of this kind, it can represent one of nine different kinds of curve. Which kind depends on the signs of the following four quantities:

Delta =
 a b d b c e d e f
,   J =
 a b b c
,   I = a + c,   K =
 a d d f
+
 c e e f
.

The cases are as follows:

```Case  Delta  J  Delta/I  K   Curve                         Standard Form

1     +/-   +     -         Real ellipse                  x2/a2 + y2/b2 = 1
2     +/-   +     +         Imaginary ellipse             x2/a2 + y2/b2 = -1
3     +/-   -               Hyperbola                     x2/a2 - y2/b2 = 1
4     +/-   0               Parabola                      x2/a2 - y = 0
5      0    -               Real intersecting lines       x2/a2 - y2/b2 = 0
6      0    +               Imaginary intersecting lines  x2/a2 + y2/b2 = 0
7      0    0           -   Real parallel lines           x2/a2 = 1
8      0    0           +   Imaginary parallel lines      x2/a2 = -1
9      0    0           0   Coincident lines              x2/a2 = 0

```
The equation can be put into standard form by making a rotation to remove the xy-term, completing the square(s), and then making a translation to move the center to the origin.

Compiled by Robert L. Ward.