# How do you differentiate  y=sqrt(sec (x^2/pi - xpi))-sec (sqrt(x^2/pi - xpi)) using the chain rule?

Feb 27, 2017

$\frac{\mathrm{dy}}{\mathrm{dx}} = \left(\frac{2 x}{\pi} - \pi\right) \left[\frac{1}{2 \sqrt{\sec \left({x}^{2} / \pi - x \pi\right)}} \sec \left({x}^{2} / \pi - x \pi\right) \tan \left({x}^{2} / \pi - x \pi\right) - \sec \left(\sqrt{{x}^{2} / \pi - x \pi}\right) \tan \left(\sqrt{{x}^{2} / \pi - x \pi}\right) \times \frac{1}{2 \sqrt{{x}^{2} / \pi - x \pi}}\right]$

#### Explanation:

Chain Rule - In order to differentiate a function of a function, say $y , = f \left(g \left(x\right)\right)$, where we have to find $\frac{\mathrm{dy}}{\mathrm{dx}}$, we need to do (a) substitute $u = g \left(x\right)$, which gives us $y = f \left(u\right)$. Then we need to use a formula called Chain Rule, which states that $\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{\mathrm{dy}}{\mathrm{du}} \times \frac{\mathrm{du}}{\mathrm{dx}}$. In fact if we have something like $y = f \left(g \left(h \left(x\right)\right)\right)$, we can have $\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{\mathrm{dy}}{\mathrm{df}} \times \frac{\mathrm{df}}{\mathrm{dg}} \times \frac{\mathrm{dg}}{\mathrm{dh}}$

Further if $f \left(x\right) = u \left(x\right) \pm v \left(x\right)$, $\frac{\mathrm{df}}{\mathrm{dx}} = \frac{\mathrm{du}}{\mathrm{dx}} \pm \frac{\mathrm{dv}}{\mathrm{dx}}$

Hence here $\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{d}{\mathrm{dx}} \sqrt{\sec \left({x}^{2} / \pi - x \pi\right)} - \frac{d}{\mathrm{dx}} \sec \left(\sqrt{{x}^{2} / \pi - x \pi}\right)$

Let us workout the two differentials separately and then we can combine them.

$\frac{d}{\mathrm{dx}} \sqrt{g \left(x\right)}$, where $g \left(x\right) = \sec \left(h \left(x\right)\right)$ and $h \left(x\right) = {x}^{2} / \pi - x \pi$

$\therefore \frac{d}{\mathrm{dx}} \sqrt{\sec \left({x}^{2} / \pi - x \pi\right)}$ using chain rule

= $\frac{1}{2 \sqrt{g \left(x\right)}} \times \sec \left(h \left(x\right)\right) \tan \left(h \left(x\right)\right) \times \left(\frac{2 x}{\pi} - \pi\right)$

= $\frac{1}{2 \sqrt{\sec \left({x}^{2} / \pi - x \pi\right)}} \times \sec \left({x}^{2} / \pi - x \pi\right) \tan \left({x}^{2} / \pi - x \pi\right) \times \left(\frac{2 x}{\pi} - \pi\right)$

and $\frac{d}{\mathrm{dx}} \sec \left(\sqrt{{x}^{2} / \pi - x \pi}\right)$

= $\sec \left(\sqrt{{x}^{2} / \pi - x \pi}\right) \tan \left(\sqrt{{x}^{2} / \pi - x \pi}\right) \times \frac{1}{2 \sqrt{{x}^{2} / \pi - x \pi}} \times \left(\frac{2 x}{\pi} - \pi\right)$

Hence, $\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{1}{2 \sqrt{\sec \left({x}^{2} / \pi - x \pi\right)}} \times \sec \left({x}^{2} / \pi - x \pi\right) \tan \left({x}^{2} / \pi - x \pi\right) \times \left(\frac{2 x}{\pi} - \pi\right) - \sec \left(\sqrt{{x}^{2} / \pi - x \pi}\right) \tan \left(\sqrt{{x}^{2} / \pi - x \pi}\right) \times \frac{1}{2 \sqrt{{x}^{2} / \pi - x \pi}} \times \left(\frac{2 x}{\pi} - \pi\right)$

= $\left(\frac{2 x}{\pi} - \pi\right) \left[\frac{1}{2 \sqrt{\sec \left({x}^{2} / \pi - x \pi\right)}} \sec \left({x}^{2} / \pi - x \pi\right) \tan \left({x}^{2} / \pi - x \pi\right) - \sec \left(\sqrt{{x}^{2} / \pi - x \pi}\right) \tan \left(\sqrt{{x}^{2} / \pi - x \pi}\right) \times \frac{1}{2 \sqrt{{x}^{2} / \pi - x \pi}}\right]$