Find the dimension and basis of $P=c_{0}+c_{1}\sin(x)\cos(x)+c_{2}\cos^{2}(x)+c_{3}\sin^{2}(x)$

Let $P$ be the set of all functions of the form $P=c_{0}+c_{1}\sin(x)\cos(x)+c_{2}\cos^{2}(x)+c_{3}\sin^{2}(x)$, where $c_0, c_1, c_2, c_3$ are arbitrary real numbers. It is known that $P$ is a linear space under the usual function addition and scalar multiplication. Find the dimension and a basis for $P$.

I'm a new student to linear algebra, and this question is really confusing, especially the "arbitrary number" part.

I'm thinking that $P$ has dimension $4$, and a basis of it is {$1, \sin(x)\cos(x), \cos^{2}(x), {3}\sin^{2}(x)$} but it kinda just sounds wrong, and I've been stuck with this for more than 2 hours. I really appreciate any help.


The set $\mathcal P$ of those functions is spanned by $\{1,\sin\cos,\sin^2,\cos^2\}$, and therefore, its dimension is at most $4$. But it is not $4$, since $\sin^2+\cos^2=1$. So, $\mathcal P$ is, in fact, spanned by$$\{1,\sin\cos,\sin^2\}.\tag1$$Is $\dim\mathcal P=3$? This is so if and only if $(1)$ is linearly independent. So, take $a,b,c\in\Bbb R$ such that $a+b\sin\cos+c\sin^2=1$. Then:

  • $a+b\sin(0)\cos(0)+c\sin^2(0)=0$, and therefore $a=0$;
  • $b\sin\left(\frac\pi2\right)\cos\left(\frac\pi2\right)+c\sin^2\left(\frac\pi2\right)=0$, and therefore $c=0$;
  • $b\sin\left(\frac\pi4\right)\cos\left(\frac\pi4\right)=0$, and therefore $b=0$.

So, the set $(1)$ is indedd linearly independent and therefore $\dim\mathcal P=3$.