Math Core

Module 4.4 · Geometry

Coordinates and trigonometry

Synthetic tricks are elegant, but they aren't always available at 2 a.m. on problem 11. Coordinates and trigonometry are the reliable backup: with a smart setup, almost any triangle problem becomes a computation. This module collects the setups and formulas that make those computations short.

Choosing coordinates

A good coordinate system does most of the work. Some habits:

  • Put a vertex at the origin and a side along the xx-axis: B=(0,0)B = (0, 0), C=(a,0)C = (a, 0), A=(p,q)A = (p, q).
  • Use symmetry: an isosceles triangle or a rectangle should be centered on an axis.
  • Put a circle's center at the origin.
  • Prefer integer coordinates. The 1313-1414-1515 triangle fits perfectly as B=(0,0)B = (0, 0), C=(14,0)C = (14, 0), A=(5,12)A = (5, 12).

To place AA when you know all three sides, solve p2+q2=c2p^2 + q^2 = c^2 and (p−a)2+q2=b2(p - a)^2 + q^2 = b^2. Subtracting gives p=a2+c2−b22ap = \dfrac{a^2 + c^2 - b^2}{2a} right away.

Area and distance formulas

Shoelace formula

A polygon with vertices (x1,y1),(x2,y2),…,(xn,yn)(x_1, y_1), (x_2, y_2), \dots, (x_n, y_n) in order around it has area

12∣∑i=1n(xiyi+1−xi+1yi)∣,(xn+1,yn+1)=(x1,y1).\frac{1}{2}\left|\sum_{i=1}^{n} (x_i y_{i+1} - x_{i+1} y_i)\right|, \qquad (x_{n+1}, y_{n+1}) = (x_1, y_1).

Why it works. The term 12(xiyi+1−xi+1yi)\tfrac12(x_i y_{i+1} - x_{i+1} y_i) is the signed area of the triangle with vertices OO, PiP_i, Pi+1P_{i+1}: positive when you turn counterclockwise from PiP_i to Pi+1P_{i+1} and negative otherwise. Walking around a polygon, the triangles fanned out from OO add up to the polygon's area, and any part outside the polygon is counted once positively and once negatively, so it cancels.

Distance from a point to a line. The distance from (x0,y0)(x_0, y_0) to the line ax+by+c=0ax + by + c = 0 is

∣ax0+by0+c∣a2+b2.\frac{|ax_0 + by_0 + c|}{\sqrt{a^2 + b^2}}.

The vector (a,b)(a, b) is perpendicular to the line. Moving from (x0,y0)(x_0, y_0) a distance tt along the unit normal changes ax+by+cax + by + c by ta2+b2t\sqrt{a^2 + b^2}, so you reach the line (where it's 00) when ∣t∣=∣ax0+by0+c∣a2+b2|t| = \dfrac{|ax_0 + by_0 + c|}{\sqrt{a^2 + b^2}}.

The trigonometry toolkit

For a triangle with sides a,b,ca, b, c opposite angles A,B,CA, B, C, circumradius RR, inradius rr and semiperimeter ss:

FormulaName
asin⁡A=bsin⁡B=csin⁡C=2R\dfrac{a}{\sin A} = \dfrac{b}{\sin B} = \dfrac{c}{\sin C} = 2Rextended law of sines
c2=a2+b2−2abcos⁡Cc^2 = a^2 + b^2 - 2ab\cos Claw of cosines
K=12absin⁡C=abc4R=rs=s(s−a)(s−b)(s−c)K = \tfrac12 ab\sin C = \dfrac{abc}{4R} = rs = \sqrt{s(s-a)(s-b)(s-c)}area

Proof of the extended law of sines. Draw the diameter BB′BB' of the circumcircle. Inscribed angles on arc BCBC are equal, so ∠BB′C=A\angle BB'C = A (or 180∘−A180^\circ - A if AA is obtuse, with the same sine). Triangle BB′CBB'C has a right angle at CC because BB′BB' is a diameter. So a=BC=BB′sin⁡A=2Rsin⁡Aa = BC = BB' \sin A = 2R\sin A.

The others follow: K=12absin⁡C=12ab⋅c2R=abc4RK = \tfrac12 ab\sin C = \tfrac12 ab \cdot \dfrac{c}{2R} = \dfrac{abc}{4R}, and splitting the triangle into three triangles from the incenter, each with height rr, gives K=12r(a+b+c)=rsK = \tfrac12 r(a + b + c) = rs.

Stewart's theorem

If DD is on side BCBC with BD=mBD = m, DC=nDC = n (so a=m+na = m + n) and AD=dAD = d, then

b2m+c2n=a(d2+mn).b^2 m + c^2 n = a(d^2 + mn).

Proof. Let θ=∠ADB\theta = \angle ADB, so ∠ADC=180∘−θ\angle ADC = 180^\circ - \theta and the cosines are opposite. The law of cosines in triangles ABDABD and ACDACD:

c2=m2+d2−2mdcos⁡θ,b2=n2+d2+2ndcos⁡θ.c^2 = m^2 + d^2 - 2md\cos\theta, \qquad b^2 = n^2 + d^2 + 2nd\cos\theta.

Multiply the first by nn and the second by mm and add; the cosine terms cancel:

c2n+b2m=mn(m+n)+d2(m+n)=a(d2+mn).■c^2 n + b^2 m = mn(m + n) + d^2(m + n) = a(d^2 + mn). \quad \blacksquare

Special cases worth memorizing: the median is ma2=2b2+2c2−a24m_a^2 = \dfrac{2b^2 + 2c^2 - a^2}{4}, and the angle bisector (with m:n=c:bm : n = c : b) is ta2=bc(1−a2(b+c)2)t_a^2 = bc\left(1 - \dfrac{a^2}{(b + c)^2}\right).

The 13-14-15 triangle with B = (0, 0), C = (14, 0), A = (5, 12). The incenter is (6, 4) and the circumcenter is (7, 33/8).Open in grapher →

Worked example: The 13-14-15 triangle

Find the area, inradius and circumradius of the triangle with sides 1313, 1414, 1515.

With A=(5,12)A = (5, 12) above base BC=14BC = 14, the area is 12⋅14⋅12=84\tfrac12 \cdot 14 \cdot 12 = 84. Then s=21s = 21, so r=8421=4r = \dfrac{84}{21} = 4, and R=13⋅14⋅154⋅84=2730336=658R = \dfrac{13 \cdot 14 \cdot 15}{4 \cdot 84} = \dfrac{2730}{336} = \dfrac{65}{8}.

In coordinates: the circumcenter is on x=7x = 7 (the perpendicular bisector of BCBC), at (7,y)(7, y) with 49+y2=4+(12−y)249 + y^2 = 4 + (12 - y)^2, so y=338y = \dfrac{33}{8} and R2=49+108964=422564R^2 = 49 + \dfrac{1089}{64} = \dfrac{4225}{64}. ✓

Worked example: A median with Stewart

In a triangle with AB=7AB = 7, AC=9AC = 9, BC=8BC = 8, find the length of the median from AA.

ma2=2⋅81+2⋅49−644=1964=49m_a^2 = \dfrac{2 \cdot 81 + 2 \cdot 49 - 64}{4} = \dfrac{196}{4} = 49, so the median has length 77.

Worked example: Trig with an altitude

In triangle ABCABC the altitude ADAD has BD=4BD = 4 and DC=6DC = 6, and ∠BAC=45∘\angle BAC = 45^\circ. Find ADAD.

Let h=ADh = AD, and split ∠A\angle A into α=∠BAD\alpha = \angle BAD and β=∠DAC\beta = \angle DAC, with tan⁡α=4h\tan\alpha = \dfrac{4}{h} and tan⁡β=6h\tan\beta = \dfrac{6}{h}. Then

1=tan⁡(α+β)=4/h+6/h1−24/h2=10hh2−24.1 = \tan(\alpha + \beta) = \frac{4/h + 6/h}{1 - 24/h^2} = \frac{10h}{h^2 - 24}.

So h2−10h−24=0h^2 - 10h - 24 = 0, and h=12h = 12.

Common mistake

When you place a triangle in coordinates, check which side is opposite which vertex. In the incenter formula I=aA+bB+cCa+b+cI = \dfrac{aA + bB + cC}{a + b + c}, each vertex is weighted by the length of the opposite side. Mixing these up is the most common coordinate bug.

Tip

Before a long coordinate bash, estimate the answer with a rough sketch. If your exact answer is 658≈8.1\dfrac{65}{8} \approx 8.1 and your picture says "about 88", you can trust the algebra.

Practice

Practice 1

Find the area of the pentagon with vertices (1,2)(1, 2), (9,1)(9, 1), (12,8)(12, 8), (6,13)(6, 13) and (0,7)(0, 7), in that order.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 2

A triangle has sides 1717, 2525 and 2828. Its circumradius is mn\dfrac{m}{n} in lowest terms. Find m+nm + n.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 3

In triangle ABCABC, AB=7AB = 7, AC=9AC = 9 and BC=8BC = 8. Point DD is on BCBC with BD=3BD = 3. Find AD2AD^2.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 4

In triangle ABCABC, BC=17BC = 17 and CA=19CA = 19, and the medians from AA and BB are perpendicular. Find AB2AB^2.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 5

In triangle ABCABC, AB=25AB = 25, AC=30AC = 30 and ∠B=2∠C\angle B = 2\angle C. Find the area of the triangle.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 6

Triangle ABCABC has AB=7AB = 7, AC=15AC = 15 and BC=20BC = 20. Let OO be its circumcenter and II its incenter. Then OI2=mnOI^2 = \dfrac{m}{n} in lowest terms. Find m+nm + n.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 7

Point PP is inside square ABCDABCD with PA=3PA = 3, PB=5PB = 5 and PC=7PC = 7. The area of the square can be written as a+bca + b\sqrt{c}, where aa, bb, cc are positive integers and cc is squarefree. Find a+b+ca + b + c.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Real contest practice

These are full past AIMEs. Each has several geometry problems; try solving at least one of them purely with coordinates or trigonometry.