# Linear independence of $\sin(x)$ and $\cos(x)$

In the vector space of $f:\mathbb R \to \mathbb R$, how do I prove that functions $\sin(x)$ and $\cos(x)$ are linearly independent. By def., two elements of a vector space are linearly independent if $0 = a\cos(x) + b\sin(x)$ implies that $a=b=0$, but how can I formalize that? Giving $x$ different values? Thanks in advance.

-
–  Mhenni Benghorbal Aug 10 '13 at 20:52

Hint: If $a\cos(x)+b\sin(x)=0$ for all $x\in\mathbb{R}$ then it is especially true for $x=0,\frac{\pi}{2}$

-
But linear independence can't be deduced only from $x=0$ since $b$ could be any value, the same if $x=\frac{\pi}{2}$ for $a$. What am I missing? –  V. Galerkin Jan 3 '13 at 12:20
@V.Galerkin: Why are you taking them one at a time?? $a\cos0+b\sin0=0$ and $a\cos\frac\pi2+b\sin\frac\pi2=0$ simultaneously. –  Rahul Jan 3 '13 at 12:24
Ok, I got it now! thanks –  V. Galerkin Jan 3 '13 at 12:27

There are easier ways - eg take special values for $x$. The following technique is a sledgehammer in this case, but a useful one to have around.

Suppose you have $a$ and $b$ as required. Let $r=\sqrt{a^2+b^2}$ and $\phi = \arctan {\frac a b}$ (take $\phi=\frac {\pi} 2$ if $b=0$). Then we have: $$a \cos (x)+b\sin(x)=r\sin(\phi)\cos(x)+r\cos(\phi)\sin(x)=r\sin(x+\phi)$$

The last form is identically zero only if $r=0$, which immediately implies $a=b=0$ from the definition of $r$.

-
Very nice! This is how you switch between trigonometric polynomials and phasors, right? –  Giuseppe Negro Jan 3 '13 at 13:44
+1 Very nice indeed. –  user1551 Jan 3 '13 at 17:20

One way to show linear independence is to use the Wronskian of $f$ and $g$, denoted by $$W(f,g)(x):=\begin{vmatrix}f(x) & g(x)\\ f'(x) & g'(x)\end{vmatrix}=f(x)g'(x)-g(x)f'(x), \quad x\in I.$$

There is a classic theorem which says that if $f,g$ are differentiable on $I$ and $W(f,g)(x_0)\not=0$ for some $x_0\in I$, then $f$ and $g$ are linearly independent on $I$.

So, in your case, $$W(\sin x,\cos x)=\sin x\cdot (-\sin x)-\cos x\cdot \cos x=-\sin^2 x-\cos^2 x=-1\not=0 \text{ for any }I,$$ so $\sin x$ and $\cos x$ are linearly independent on any interval $I$.

-
I don't think the converse you state is a converse, is it not the contrapositive? –  user50407 Jan 3 '13 at 12:01
Sorry, mistype. –  JohnD Jan 3 '13 at 12:02

$$b\sin(x)=-a\cos(x)$$ The left side is odd, the right side is even, thus they cannot be equal for all $x$, as if the functions are equal for (say) positive $x$, they must be equal in magnitude but with opposite signs for negative $x$, unless $a=b=0$ (this is true in general for all pairs of nonzero even and odd functions).

-

If both are linearly dependent then, by assuming $x \neq 0$ or $n\pi$ for $n \in \mathbb Z$

$$\cos(x)/\sin(x) = -b/a$$

now let $x = \pi/2$ so $b = 0$;

but then $$a\sin(x) = 0$$ let $x = \pi/2$ so $$a =0$$

-

This is an infinite-dimensional linear problem, because the space $\mathbb{R}^\mathbb{R}$ of real functions of a real variable has not finite dimension. Therefore you cannot use the typical tools of linear algebra: matrices, determinants and the like. To overcome this difficulty you can try sampling the two functions at some points (nodes, to use a more technical jargon) to be determined. Indeed we can prove the following proposition.

Proposition. Let $f_1\ldots f_n \colon \mathbb{R}\to \mathbb{R}$. Suppose that there exist points $(x_1\ldots x_n)$ such that \begin{align} &(f_1(x_1)&\ldots& f_n(x_1)) \\ &(f_1(x_2)&\ldots& f_n(x_2)) \\ &&\ldots&\\ &(f_1(x_n)&\ldots& f_n(x_n)) \end{align} are linearly independent vectors in $\mathbb{R}^n$. Then the functions $f_1\ldots f_n$ are linearly independent.

Proof If the coefficients $a_1\ldots a_n\in \mathbb{R}$ are such that $$\tag{1}a_1 f_1+\ldots +a_nf_n=0,$$ then evaluating (1) at $x_1\ldots x_n$ we have \begin{align} a_1f_1(x_1) +\ldots +a_nf_n(x_1)&=0 \\ &\vdots\\ a_1f_1(x_n)+\ldots +a_nf_n(x_n)&=0 \end{align} which can be rewritten in matrix form $$\begin{bmatrix} f_1(x_1) & \ldots & f_n(x_1) \\ \ldots& \ldots &\ldots \\ f_1(x_n) & \ldots & f_n(x_n) \end{bmatrix} \begin{bmatrix} a_1\\ \vdots \\ a_n \end{bmatrix} =0.$$ By assumption the coefficient matrix is nonsingular and so this equation only has the trivial solution $(a_1\ldots a_n)=(0\ldots 0)$. This proves that $f_1\ldots f_n$ are linearly independent. $\square$

For the case at hand, we have two functions so $n=2$. Choosing nodes $x_1=0, x_2=\pi/2$ we get the sampled vectors $(1, 0), (0, 1)$, which clearly are linearly independent.

-

Although I'm not confident about this, maybe you can use power series for $\sin x$ and $\cos x$? I'm working on a similar exercise but mine has restricted both functions on the interval $[0,1]$.

-
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. –  Woodface Jun 7 '14 at 1:52
@wordsthatendinGRY Isn't it giving a hint for the answer? And the user can't comment yet. –  M. Vinay Jun 7 '14 at 1:57

If Cos(x) and sin(x) are linearly independent, then this implies.

acos(x)+bsin(x)=0 if and only if (for all values of x) a=b=0.

But!! For x=pi/4 rad; cos(pi/4)=sin(pi/4)= sqrt(2)/2 and for a=1 and b=-1 we get: (1)*sqrt(2)/2 +(-1)*sqrt(2)/2 which is sqrt(2)/2-sqrt(2)/2=0. Therefore: cos(x) and sin(x) cannot be linearly independent.

-
I know what I said is false, cos(x) and sin(x) are actually linearly independent. But using the classical method gives me this seeming anomaly. I don't have problems with polynomials. Hmmm –  Geoff Ross Feb 27 at 4:00

I think that you should verify $a\cos(x)+b\sin(x)=0$ for every $x$ implies $$a=b=0$$

-
Right! but how do I formalize that? –  V. Galerkin Jan 3 '13 at 11:32
$cos(x)$ and $sin(x)$ cannot be both equal to zero at the same time, so it implies that $a=b=0$ –  Alan Simonin Jan 3 '13 at 11:37
@V. Galerkin: FYI, a neat way to see why Alan Simonin's comment is true ($\cos x$ and $\sin x$ cannot both be zero for the same value of $x$) is that if it wasn't true, then the identity ${\cos}^{2}x + {\sin}^{2}x = 1$ would not hold for that value of $x.$ –  Dave L. Renfro Jan 3 '13 at 16:03
@Alan Simonin: It seems to me more is needed to justify $a=b=0$ than the fact that $\cos x$ and $\sin x$ cannot both be zero for the same value of $x.$ For example, consider $(a \cdot 3)+(b \cdot 6) = 0,$ where $3$ and $6$ are considered as constant functions of $x.$ In this example, $3$ and $6$ cannot both be zero for the same value of $x$ (since neither can be zero for any value of $x$), but $a=6$ and $b = -3$ shows that $a = b = 0$ does not automatically follow. –  Dave L. Renfro Jan 3 '13 at 16:18
@DaveL.Renfro Yes, but in this case, 3 and 6 are not linearly independant –  Alan Simonin Jan 3 '13 at 17:24