How do you differentiate f(x) = tan(x + sec x) ?

${f}^{'} \left(x\right) = {\sec}^{2} \left(x + \sec \left(x\right)\right) \left[1 + \tan \left(x\right) \sec \left(x\right)\right]$

Explanation:

When we find functions of functions, the answer is the chain rule, 99% of the times. Let's recall it: if $h$ and $k$ are two differentiable functions on ]a,b[, then forall x in ]a,b[
${\left[h \left(k \left(x\right)\right)\right]}^{'} = {h}^{'} \left(k \left(x\right)\right) {k}^{'} \left(x\right)$

In this specific case
$h \left(u\right) = \tan \left(u\right)$
$k \left(x\right) = x + \sec \left(x\right)$
and the derivatives are
${h}^{'} \left(u\right) = \frac{1}{\cos} ^ 2 \left(u\right) = {\sec}^{2} \left(u\right)$
${k}^{'} \left(x\right) = 1 + \sin \frac{x}{\cos} ^ 2 \left(x\right) = 1 + \sin \frac{x}{\cos} \left(x\right) \frac{1}{\cos} \left(x\right) = 1 + \tan \left(x\right) \sec \left(x\right)$

So putting all together:
${f}^{'} \left(x\right) = {\left[\tan \left(x + \sec \left(x\right)\right)\right]}^{'} = {\sec}^{2} \left(x + \sec \left(x\right)\right) \left[1 + \tan \left(x\right) \sec \left(x\right)\right]$

Note: To derive the tangent function and the secant function, we can recall their definitions:
${\left[\tan \left(x\right)\right]}^{'} = {\left[\sin \frac{x}{\cos} \left(x\right)\right]}^{'} = \frac{\cos \left(x\right) \cos \left(x\right) - \sin \left(x\right) \left[- \sin \left(x\right)\right]}{\cos} ^ 2 \left(x\right) = \frac{{\cos}^{2} \left(x\right) + {\sin}^{2} \left(x\right)}{{\cos}^{2} \left(x\right)} = \frac{1}{{\cos}^{2} \left(x\right)} = {\left[\frac{1}{\cos} \left(x\right)\right]}^{2} = {\sec}^{2} \left(x\right)$
${\left[\sec \left(x\right)\right]}^{'} = {\left[\frac{1}{\cos} \left(x\right)\right]}^{'} = - \frac{- \sin \left(x\right)}{\cos} ^ 2 \left(x\right) = \sin \frac{x}{\cos} \left(x\right) \cdot \frac{1}{\cos} \left(x\right) = \tan \left(x\right) \sec \left(x\right)$