Answer
$$\frac{1}{21} \cos ^{6} 3 x \sin 3 x+\frac{2}{35} \cos ^{4} 3 x \sin 3 x+\frac{8}{105} \cos ^{2} 3 x \sin 3 x+\frac{16}{105} \sin 3 x+c$$
Work Step by Step
Given
$$\int \cos ^{7} 3 x d x=\frac{1}{3} \int \cos ^{7} u d u $$
Let
$$u=3x\ \ \ \Rightarrow \ \ du=3dx $$
By using
$$\int \cos ^{n} x d x=\frac{\cos ^{n-1} x \sin x}{n}+\frac{n-1}{n} \int \cos ^{n-2} x d x$$
we get
\begin{align*}
\int \cos ^{7} 3 x d x&=\frac{1}{3} \int \cos ^{7} u d u\\
&=\frac{1}{21} \cos ^{6} u \sin u+\frac{6}{21} \int \cos ^{5} u d u (12), \ \ n=7\\
&=\frac{1}{21} \cos ^{6} u \sin u+\frac{2}{7}\left(\frac{1}{5} \cos ^{4} u \sin u+\frac{4}{5} \int \cos ^{3} u d u\right),\ \ n=5 \\
&=\frac{1}{21} \cos ^{6} u \sin u+\frac{2}{5} \cos ^{4} u \sin u+\frac{8}{35}\left(\frac{1}{3} \cos ^{2} u \sin u+\frac{2}{3} \int \cos u d u\right) ,\ \ n=3\\
&= \frac{1}{21} \cos ^{6} u \sin u+\frac{2}{35} \cos ^{4} u \sin u+\frac{8}{105} \cos ^{2} u \sin u+\frac{16}{105} \sin u+c\\
&=\frac{1}{21} \cos ^{6} 3 x \sin 3 x+\frac{2}{35} \cos ^{4} 3 x \sin 3 x+\frac{8}{105} \cos ^{2} 3 x \sin 3 x+\frac{16}{105} \sin 3 x+c
\end{align*}