Solution (source code)

= Solution

The <derivative> of $\cot u$ is $-\csc^2u$. The <chain rule> therefore gives
$$
\boxed{\int\frac{dx}{\sin^2(3x+1)}=-\frac13\cot(3x+1)+C.}
$$
The <antiderivative> applies on any interval containing no zero of $\sin(3x+1)$.