<s>[INST] Integrate $\int \frac{\tan \left(x\right)}{\sin ^2\left(x\right)}dx\cdot \int \log _{3x}\left(x^2\right)dx$. 
Integrate the following integral:
$$\int \frac{\tan \left(x\right)}{\sin ^2\left(x\right)}dx\cdot \int \log _{3x}\left(x^2\right)dx$$

I did this question a while ago and the answer is correct. However, when I started revising this topic again, I can't seem to figure out how I went from the first step $\left( \text{for this integral}\int \log _{3x}\left(x^2\right)dx\right)$ to the second step. Here's my attempt:
\begin{align}
\int \frac{\tan \left(x\right)}{\sin ^2\left(x\right)}dx  &= {\int{\frac{2}{\sin{\left(2 x \right)}} d x}} \\
&= {\int{\frac{1}{\sin{\left(x \right)} \cos{\left(x \right)}} d x}} \\
&= {\int{\frac{\sec^{2}{\left(x \right)}}{\tan{\left(x \right)}} d x}} \\
&\stackrel{{u = \tan{\left(x\right)}}}{=} {\int{\frac{1}{u} d u}} \\
&= {\ln{\left(u \right)}} + c \\
&= \ln{\left(\left|{\tan{\left(x \right)}}\right| \right)}+
\end{align}
\begin{align}
\int \log _{3x}\left(x^2\right)dx &= x\log _{3x}\left(x^2\right)-\int \frac{2\ln \left(3\right)}{\ln ^2\left(3x\right)}dx \\
&= x\log _{3x}\left(x^2\right)-\left(-\frac{2\ln \left(3\right)x}{\ln \left(3x\right)}+\frac{2}{3}\ln \left(3\right)\text{Ei}\left(\ln \left(3x\right)\right)\right) \\
&= 2x\log _{3x}\left(x\right)+\frac{2\ln \left(3\right)x}{\ln \left(3x\right)}-\frac{2}{3}\ln \left(3\right)\text{Ei}\left(\ln \left(3x\right)\right) + c
\end{align}
Therefore:
$$\int \frac{\tan \left(x\right)}{\sin ^2\left(x\right)}dx\cdot \int \log _{3x}\left(x^2\right)dx = \left(\ln \left|\tan \left(x\right)\right|+c\right)\left(2x\log _{3x}\left(x\right)+\frac{2\ln \left(3\right)x}{\ln \left(3x\right)}-\frac{2}{3}\ln \left(3\right)\text{Ei}\left(\ln \left(3x\right)\right)+c\right)$$
 [/INST] I think you are asking to verify that
$$\frac{\tan \left(x\right)}{\sin ^2\left(x\right)}.$$ RIGHT?
if so, $$\frac{\sin(x)/\cos(x)}{\sin ^2\left(x\right)}=\frac{1}{\sin(x)\cos(x)}=\frac{2}{2 \sin(x)\cos(x)}=\frac{2}{\sin(2x)}$$
</s>