Prove that $4\tan^{-1}\left(\frac{1}{5}\right) - \tan^{-1}\left(\frac{1}{239}\right)= \frac{\pi}{4}$

We can also use

$$\arctan(u) \pm \arctan(v) = \arctan\left(\frac{u \pm v}{1 \mp uv}\right)$$

to obtain in four steps

$$\frac{\frac15 - \frac1{239}}{1 + \frac1{5\cdot 239}}=\frac{239-5}{5\cdot 239+1}=\frac{234}{5\cdot 239+1}=\frac9{46} \to$$

$$\to \frac{\frac15 + \frac9{46}}{1 - \frac15\frac9{46}}= \frac7{17} \\\to \frac{\frac15 + \frac7{17}}{1 - \frac15\frac7{17}}= \frac2{3} \\\to \frac{\frac15 + \frac2{3}}{1 - \frac15\frac2{3}}= 1$$


Shortest proof:

$$(5+i)^4(239-i)=114244+114244i.$$

Taking the arguments,

$$4\arctan \frac15-\arctan\frac1{239}=\frac\pi4.$$


Note that the computation avoids the fractions and immediately generalizes to other Machin-like formulas (https://en.wikipedia.org/wiki/Machin-like_formula#More_terms).


To perform the computation by hand, consider

$$(5+i)^2=24+10i\propto12+5i,$$

$$(12+5i)^2=119+120i,$$

$$(119+120 i)(239-i)=(119\cdot239+120)+(120\cdot239-119)i\propto 1+i.$$

(After simplification by $119\cdot239$, we have $120=239-119$.)