Step 1: Write the integral clearly.
We need to evaluate:
\[
I=\int \left(\frac{\sin 3x}{\sin x}-\frac{\cos 3x}{\cos x}\right)\,dx
\]
Step 2: Use the triple-angle formulas.
Recall:
\[
\sin 3x=3\sin x-4\sin^3 x
\]
and
\[
\cos 3x=4\cos^3 x-3\cos x
\]
Step 3: Divide each expression by \(\sin x\) and \(\cos x\).
Then,
\[
\frac{\sin 3x}{\sin x}=\frac{3\sin x-4\sin^3 x}{\sin x}=3-4\sin^2 x
\]
and
\[
\frac{\cos 3x}{\cos x}=\frac{4\cos^3 x-3\cos x}{\cos x}=4\cos^2 x-3
\]
Step 4: Substitute back into the integrand.
So the integrand becomes:
\[
(3-4\sin^2 x)-(4\cos^2 x-3)
\]
\[
=3-4\sin^2 x-4\cos^2 x+3
\]
\[
=6-4(\sin^2 x+\cos^2 x)
\]
Step 5: Use the identity \(\sin^2 x+\cos^2 x=1\).
Therefore,
\[
6-4(\sin^2 x+\cos^2 x)=6-4(1)=2
\]
So the integral reduces to:
\[
I=\int 2\,dx
\]
Step 6: Integrate the constant.
\[
I=2x+C
\]
Step 7: State the final answer.
Hence,
\[
\boxed{\int \left(\frac{\sin 3x}{\sin x}-\frac{\cos 3x}{\cos x}\right)\,dx=2x+C}
\]
which matches option \((4)\).