# Derivative of tan x with respect to x

## Formula

$\large \dfrac{d}{dx} \, \tan x = sec^2 x$

### Proof

Mathematically, the derivative of tan of an angle with respect to the same angle can be derived in calculus by using the relation of differentiation of a function in limits form.

$\dfrac{d}{dx} \, f(x)$ $=$ $\displaystyle \lim_{h \to 0} \, \dfrac{f(x+h)-f(x)}{h}$

###### Step: 1

Take $f(x) = \tan x$ then $f(x+h) = \tan(x+h)$. Substitute these two functions and start deriving the differentiation formula of trigonometric function tangent.

$\dfrac{d}{dx} \, \tan x$ $\,=\,$ $\displaystyle \lim_{h \to 0} \dfrac{\tan(x+h) -\tan x}{h}$

###### Step: 2

Write tan functions in terms of the ratio of sine to cosine functions as per quotient trigonometric identity.

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\displaystyle \lim_{h \to 0} \dfrac{\dfrac{\sin(x+h)}{\cos(x+h)} -\dfrac{\sin x}{\cos x}}{h}$

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\displaystyle \lim_{h \to 0} \dfrac{\dfrac{\sin(x+h)\cos x -\cos(x+h)\sin x}{\cos(x+h)\cos x}}{h}$

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\displaystyle \lim_{h \to 0} \dfrac{\sin(x+h)\cos x -\cos(x+h)\sin x}{h\cos(x+h)\cos x}$

###### Step: 3

The numerator represents the expansion of sine of difference of two angles. Hence, the entire expression in numerator can be simply written as the expansion of sine of an angle.

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\displaystyle \lim_{h \to 0} \dfrac{\sin(x+h-x)}{h\cos(x+h)\cos x}$

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\displaystyle \lim_{h \to 0} \require{\cancel} \dfrac{\sin(\cancel{x}+h-\cancel{x})}{h\cos(x+h)\cos x}$

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\displaystyle \lim_{h \to 0} \dfrac{\sin h}{h\cos(x+h)\cos x}$

###### Step: 4

The ratio can be split as two multiplying factor functions to write terms $\sin h$ and $h$ as a ratio to apply limit sinx/x rule when the value $x$ tends to zero.

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\displaystyle \lim_{h \to 0} \dfrac{\sin h}{h}$ $\times$ $\dfrac{1}{\cos(x+h)\cos x}$

###### Step: 5

Apply the limit rule for the product of functions.

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\displaystyle \lim_{h \to 0} \dfrac{\sin h}{h}$ $\times$ $\displaystyle \lim_{h \to 0}\dfrac{1}{\cos(x+h)\cos x}$

###### Step: 6

The value of limit of ratio of $\dfrac{\sin h}{h}$ is equal to $1$ when $h$ approaches $0$ in the case of first multiplying limit function. Substitute $h = 0$ in the second multiplying function.

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $1\times \dfrac{1}{\cos(x+0)\cos x}$

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\dfrac{1}{\cos x \cos x}$

$\implies \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\dfrac{1}{\cos^2 x}$

$\therefore \,\,\,\,\,\, \dfrac{d}{dx} \, \tan x$ $\,=\,$ $\sec^2 x$

It is derived that the derivative of tan x with respect to x is square of secant of x.