you're making your life WWWAAAYYYY too complicated. simplify intermediate steps before moving on

well, by definition, the derivative of ln|sec(x) + tan(x)| = sec(x), but let's pretend we didn't know that.

we have to use the chain rule:

f(x) = 3ln|sec(x) + tan(x)|

=> f ' (x) = 3[1/(sec(x) + tan(x)) * (sec(x)tan(x) + sec^2(x))]

.............= 3[{sec(x)tan(x) + sec^2(x)}/{sec(x) + tan(x)}]

.............= 3[sec(x){tan(x) + sec(x)}/{sec(x) + tan(x)}]

.............= 3sec(x)

=> f '' (x) = 3sec(x)tan(x)