# The identity $\tan({\pi\over4}-{a\over2}) = \sec(a)-\tan(a)$

Today I was solving an exercise and while checking the solution on WolframAlpha, the website used the following identity: $$\tan \left({\pi\over4}-{\alpha\over2} \right) = \sec(\alpha)-\tan(\alpha)$$ Since I've never seen that formula, I tried to calculate it with the identities I know, especially using $$\tan \left({\pi\over4}-{\alpha\over2} \right) = {(1-\tan({\alpha\over2}))\over(1+\tan({\alpha\over2}))},$$ but I couldn't make it work.

Is this a known property of trigonometry, like for example $\cos({\pi\over2}-x)=\sin(x)$?

The identity $$\sec x \pm \tan x = \tan\left( \frac \pi 4 \pm \frac x 2 \right)$$ is one that I sometimes think of as the "cartographers' tangent half-angle formula" because of the way in which it arises in the theory of the Mercator projection, i.e. in finding the antiderivative of the secant function. The desire to find the antiderivative of the secant function came from its application to cartography in the late 1500s and early 1600s.

Recall that $\sec(\pm x) = \sec x$ and $\tan(\pm x)=\pm\tan x$, so when the sign of $x$ changes, the sign of $\tan x$ changes but that of $\sec x$ does not. Or in other words, secant is even and tangent is odd.

Since $x$ appears on the right side only in $\dfrac x 2$, and on the right side without such a fraction, you should expect to either prove a half-angle formula or rely on one that's already proved. Recall that $$\tan \frac x 2 = \frac{\sin x}{1+\cos x}.$$ So \begin{align} & \tan\left( \frac \pi 4 \pm \frac x 2 \right) = \frac{\sin\left( \frac \pi 2 \pm x \right)}{1+\cos\left(\frac\pi2 \pm x\right)} = \frac{\cos x}{1\mp \sin x} = \frac{(\cos x)(1\pm\sin x)}{(1\mp\sin x)(1\pm\sin x)} \\[10pt] = {} & \frac{(\cos x)(1\pm\sin x)}{1-\sin^2 x} = \frac{(\cos x)(1\pm\sin^2 x)}{\cos^2 x} = \frac{1\pm\sin x}{\cos x} = \frac 1 {\cos x} \pm \frac{\sin x}{\cos x} \\[10pt] = {} & \sec x \pm \tan x. \end{align}

Denote $\tan(\alpha/2)=t$. Then $$\sin \alpha = \dfrac{2t}{1+t^2}, \quad \cos \alpha = \dfrac{1-t^2}{1+t^2}, \quad \tan \alpha = \dfrac{2t}{1-t^2}.$$ Then $$\tan\left(\frac{\pi}{4}-\frac{\alpha}{2}\right) = \dfrac{1-t}{1+t} = \dfrac{(1-t)(1-t)}{(1+t)(1-t)} = \dfrac{(1+t^2)-2t}{1-t^2}$$ $$= \dfrac{1+t^2}{1-t^2} - \dfrac{2t}{1-t^2} = \frac{1}{\cos \alpha} - \tan \alpha$$ $$=\sec\alpha - \tan\alpha.$$

Here's a couple of trigonographs:

\begin{align} \sec\theta - \tan\theta \;=\; \tan\phi \;=\; \tan\frac{90^\circ - \theta}{2} \;=\; \tan\left( 45^\circ - \frac{\theta}{2}\;\right) \\[4pt] \sec\theta + \tan\theta \;=\; \tan\psi \;=\; \tan\frac{90^\circ + \theta}{2} \;=\; \tan\left( 45^\circ + \frac{\theta}{2}\;\right) \end{align}

Yes.

Wikipedia states $$\tan x + \sec x = \tan\left(\frac{x}{2}+\frac{\pi}{4}\right)$$ Re-arranging, we solve for $\sec x$: $$\sec x = \tan\left(\frac{x}{2}+\frac{\pi}{4}\right) - \tan x = \overbrace{\tan x + \tan\left(\frac{\pi}{4}-\frac{x}{2}\right)}^{\text{Your identity}}$$ We know that because $\tan x$ is an odd function, $$\tan (-x) = - \tan x \to \tan\left(\frac{x}{2}-\frac{\pi}{4}\right)=-\tan\left(\frac{\pi}{4}-\frac{x}{2}\right)$$ It should then be possible to prove your identity, via only a few more steps: $$\tan\left(\frac{x}{2}+\frac{\pi}{4}\right)+\tan\left(\frac{x}{2}-\frac{\pi}{4}\right)=2\tan x$$

The identity also pops up in Cayley's explanation of the integral of $\sec x$.

Let $a=2\theta$, and write $s=\sin\theta$ and $c=\cos\theta$ for convenience. Then

$$\sec2\theta-\tan2\theta={1\over c^2-s^2}-{2sc\over c^2-s^2}={s^2+c^2-2sc\over c^2-s^2}={c-s\over c+s}$$

while

$$\tan\left({\pi\over4}-\theta\right)={1-\tan\theta\over1+\tan\theta}={c-s\over c+s}$$

Using the identity $\sin^2(a)+cos^2(a)=1$ and dividing by $\cos^2(a)$ gives you the identity $\tan^2(a)+1=\sec^2(a)$. So $\tan(a)=\sqrt{sec^2(a)-1}$. Using this we have:

$$\begin{split} \tan\left(\frac{\pi}{4}-\frac{a}{2}\right)&=\sqrt{\sec^2\left(\frac{\pi}{4}-\frac{a}{2}\right)-1} \\ &=\sqrt{\frac{1}{\cos^2\left(\frac{\pi}{4}-\frac{a}{2}\right)} -1} \\ \end{split}$$

Then using $\cos^2(a)=\frac{2\cos(2a)+1}{2}$ we get:

$$\begin{split} \sqrt{\frac{1}{\cos^2\left(\frac{\pi}{4}-\frac{a}{2}\right)} -1} &= \sqrt{\frac{2}{\cos\left(\frac{\pi}{2}-a\right)+1}-1 } \\ &=\sqrt{\frac{2-1-\sin(a)}{\sin(a)+1} }\\ &= \sqrt{\frac{1-\sin(a)}{1+\sin(a)}} \\ &= \sqrt{\frac{(1-\sin(a))^2}{1-\sin^2(a)}} \\ &= \frac{1-\sin(a)}{\cos(a)} \\ &=\sec(a)-\tan(a) \end{split}$$

Let $b=\frac{a}{2}$, then we need to prove that $$\tan(\frac{\pi}{4}-b) = \sec (2b)-\tan (2b)$$ So here is the proof $$\begin{array}{lll} &\tan(\frac{\pi}{4}-b)&=&\frac{\tan\frac{\pi}{4}-\tan b}{1+\tan\frac{\pi}{4}\tan b}\\ &&=&\frac{1-\tan b}{1+\tan b}\\ &&=&\frac{1-\tan b}{1+\tan b}\cdot\frac{\cos b}{\cos b}\\ &&=&\frac{\cos b-\sin b}{\cos b+\sin b}\\ &&=&\frac{\cos b-\sin b}{\cos b+\sin b}\cdot\frac{\cos b - \sin b}{\cos b - \sin b}\\ &&=&\frac{(\cos b-\sin b)^2}{\cos^2 b-\sin^2 b}\\ &&=&\frac{\cos^2 b - 2\sin b \cos b + \sin^2 b}{\cos^2 b-\sin^2 b}\\ &&=&\frac{1-\sin 2b}{\cos 2b}\\ &&=&\frac{1}{\cos 2b}-\frac{\sin 2b}{\cos 2b}\\ &&=&\sec 2b-\tan 2b\\ \end{array}$$