The derivative of the function #tan x# can be found using the quotient rule, and remembering #tan x = (sin x)/(cos x)#:
#f(x) = (g(x))/(h(x)), f'(x) = (g'(x)h(x) - g(x)h'(x))/(h^2(x)#
#tan (x) = sin(x)/cos(x), d/dx tan(x) = ((cos^2x)dx + (sin^2x)dx)/(cos^2(x))#
If we substitute #3x+2# in place of #x#, then because #d/dx (3x+2) = 3#, we multiply by 3 any portion where we took the derivative with respect to x, as indicated by the #dx# placed in the function above.
#d/dx tan(3x+2) = ((3cos^2(3x+2) + 3 sin^2(3x+2))/(cos^2 (3x+2))) = 3(cos^2(3x+2)+sin^2(3x+2))/(cos^2(3x+2) )= (3*1)/cos^2(3x+2) = 3 sec^2(3x+2)#
We perform this last step by recalling our trig identities, namely that #sin^2u + cos^2u = 1#, where #u# is any real, defined expression.