#g(x)=sec(3x+1)#
First find the derivative. Use the derivative of the #secant# function is the product of #sec * tan# functions. And use the chain rule:
For #g(x)=sec(f(x))#, the derivative is:
#g'(x)=sec(f(x)tan(f(x))*f'(x)#
(Alt notation: #g(x)=secu# the #g'(x)=secu tanu * (du)/(dx)#)
#g'(3x+1)=sec(3x+1)tan(3x+1)*3=3sec(3x+1) tan(3x+1)#
For the second derivative we'll need the derivatives of #sec#, and #tan#, and we'll need the chain rule and the product rule.
#g'(3x+1)=3 color(red)(sec(3x+1)) color(green) (tan(3x+1))#
#g''(x)=3[color(red)(3sec(3x+1)tan(3x+1))color(green) (tan(3x+1)) + color(red)(sec(3x+1)) color(green) (sec^2(3x+1)*3) ]#
#g''(x)=3[3sec(3x+1) tan^2 (3x+1) + 3sec^3(3x+1)]#
To make the answer look a bit neater, either distribute the outermost #3#, or factor the #3sec(3x+1)#
#g''(x)=9sec(3x+1)[tan^2 (3x+1) + sec^2(3x+1)]#
If you prefer one trigonometric function, replace #tan^2(3x+1)# with #sec^2 (3x+1) -1#.