Recall that d/dxln(x)=1/x
Furthermore, if we have a natural logarithm whose argument is another function, ln(f(x)), we can say
d/dxln(f(x))=1/f(x)*d/dxf(x) As per the Chain Rule.
Let's take a look at ln(tan(x)):
d/dxln(tan(x))=1/tan(x) * d/dxtan(x)
d/dxln(tan(x))=sec^2(x)/tan(x)
Let's simplify this a bit, using the fact that sec^2(x)=1+tan^2(x):
d/dxln(tan(x))=(1+tan^2(x))/tan(x)=1/tan(x)+(tan^(cancel(2)1)(x))/canceltan(x)=1/tan(x)+tan(x)=cot(x)+tan(x)
Recall that d/dxtan(x)=sec^2(x).
If we have a tangent function whose argument is another function, tan(f(x)), we can say
d/dxtan(f(x))=sec^2(f(x))*d/dxf(x) As per the Chain Rule.
Looking at tan(ln(x)):
d/dxtan(ln(x))=sec^2(ln(x))*1/x=sec^2(ln(x))/x
Combining our two derivatives together, we get
g'(x)=d/dx(ln(tan(x))-tan(ln(x))
g'(x)=d/dxln(tan(x))-d/dxtan(ln(x))
g'(x)=cot(x)+tan(x)-(sec^2(ln(x)))/x
For g''(x):
d/dxcot(x)=-csc^2(x)
d/dx(tan(x))=sec^2(x)
d/dx(sec^2(ln(x)))/x=(xd/dxsec^2(ln(x))-sec^2ln(x)d/dxx)/x^2
This gives us:
((2cancelx2sec(lnx)sec(lnx)tan(lnx))/cancelx-sec^2(lnx))/x^2
(sec^2(lnx)tan(lnx)-sec^2(lnx))/x^2
g''(x)=sec^2(x)-csc^2(x)-(2sec^2(lnx)tan(lnx)-sec^2(lnx))/x^2