Assume $f=[a_1,a_2,a_3,a_4]$ and $g=[b_1,b_2,b_3,b_4]$, you'll have $$f(x)=a_1\frac1{\sqrt2}+a_2\cos x+a_3\cos (2x)+a_4\cos (3x)\\g(x)=b_1\frac1{\sqrt2}+b_2\cos x+b_3\cos (2x)+b_4\cos (3x)$$
The inner product $\left$ would be
$$\left=\int_0^{2\pi}f(x)g(x)\mathrm{d}x$$ Before we begin integrating it's worth noting that for every distinct $m,n \in\Bbb{Z}$ and $m,n\geq0$
$$
\begin{align}
\int_0^{2\pi}\cos(mx)\cos(nx)\mathrm{d}x&=\frac12\int_0^{2\pi}\cos((m+n)x)+\frac12\int_0^{2\pi}\cos((m-n)x)\mathrm{d}x\\
&=0+0\\&=0
\end{align}
$$
(Note that the RHS integrals are on a whole period of $\cos({kx})$ where $k\in\Bbb{N}$, so they equal zero.)
Going back to the inner product, now we know that the integrals $\int_0^{2\pi}\cos x\mathrm{d}x$, $\int_0^{2\pi}\cos(2x)\mathrm{d}x$, $\int_0^{2\pi}\cos(3x)\mathrm{d}x$, $\int_0^{2\pi}\cos x\cos(2x)\mathrm{d}x$, $\int_0^{2\pi}\cos x\cos(3x)\mathrm{d}x$, and $\int_0^{2\pi}\cos(2x)\cos(3x)\mathrm{d}x$ are zero, so we can omit them from the multiplication result. What remains is
$$
\begin{align}
\left&=\int_0^{2\pi}f(x)g(x)\mathrm{d}x\\
&=\int_0^{2\pi}\left(a_1b_1\frac12+a_2b_2\cos^2x+a_3b_3\cos^2(2x)+a_4b_4\cos^2(3x)\right)\mathrm{d}x
\end{align}
$$
but since for $k\in\Bbb{Z}$
$$
\begin{align}
\int_0^{2\pi}\cos^2(kx)\mathrm{d}x&=\int_0^{2\pi}\left(\frac12+\frac12 \cos(2kx)\right)\mathrm{d}x\\
&=\pi+0\\&=\pi
\end{align}
$$
we'll have
$$
\begin{align}
\left&=a_1b_1\pi+a_2b_2\pi+a_3b_3\pi+a_4b_4\pi\\
&=\pi(a_1b_1+a_2b_2+a_3b_3+a_4b_4)
\end{align}
$$
which is what you want.