# How do we know $\sin$ and $\cos$ are the only solutions to $y'' = -y$?

According to Wikipedia, one way of defining the sine and cosine functions is as the solutions to the differential equation $$y'' = -y$$.

How do we know that sin and cos (and linear combinations of them, to include $$y=e^{ix}$$) are the only solutions to this equation?

It seems like a clever combination of inverse polynomials or exponentials could do the same.

• Note: exponential $y=e^{ix}=\cos x + i \sin x$ is a solution (linear combination of $\cos, \sin$); in general, an $n^{th}$-order ODE has $n$ linearly independent solutions. Jul 15, 2019 at 1:08
• What's an "inverse polynomial"? Jul 15, 2019 at 1:10
• Change "constant multiples of them" to "linear combinations of them" and you have a correct statement.
– user856
Jul 15, 2019 at 1:17
• @coffeemath e.g. $1/{(x^2+2x+3)}$. Obviously this example isn't a solution, but you can see how taking derivatives of such functions produces functions with a similar form.
– Max
Jul 15, 2019 at 1:23

One way to show uniqueness is the following:

$$\textbf{Theorem:}$$ A second order differential equation of the form $$y''+P(x)y'+Q(x)y=0$$ has at most two linearly independent solutions.

$$\text{Sketch of Proof: }$$ 1) Define the Wronskian determinant as $$\det W_3$$ where:$$W_3=\begin{bmatrix}y_1 &y_2 &y_3\\y_1' &y_2' &y_3'\\y_1'' &y_2'' &y_3''\end{bmatrix}$$ Here the $$y_i$$'s solve the aforementioned equation.

1. Show that

$$\exists ~c_i:\sum_{i=1}^3c_iy_i=0\iff \det W_3=0$$

1. Since $$y_i''=-P(x)y_i'-Q(x)y_i$$, line 3 is a linear combination of lines 1 and 2. Thus the matrix does not have full column rank and it's determinant is zero, and hence the 3 functions have to be linearly dependent.

You can use this theorem as follows: If you find two linearly independent solutions to a linear second order ODE, then every solution to that ODE can be expressed as a linear combination of those two. In your case, you know $$\sin x, \cos x$$ are solutions and you need to look no further, since they are linearly independent (calculate $$W_2$$ and it is non-zero).

For the particular case considered, one can also solve the equation using quadrature and obtain a general solution that looks like $$y(x)=C_1\sin x+C_2 \cos x$$.

EDIT: Proof of Lemma 2

To answer @blue 's comment completely, it is true that the proof of that statement is not JUST linear algebra, but in my opinion, it is still pretty easy to prove with no other machinery to be used other than the fact that a function that has zero derivative is constant. Here is a way that can be used to show both directions:

Specifically, let us assume that $$\det W_3=0$$ and also that all the $$2\times 2$$ sub-Wronskians between any two functions of the set $$\{y_1,y_2,y_3\}$$ are non-zero (if any of them were, then there would exist non-zero $$c_i$$'s that render the functions linearly dependent hence making the Wronskian vanish trivially).In this case, with

$$T_{ij}=y'_iy_j-y'_jy_i=y_j^2\left(\frac{y_i}{y_j}\right)'\neq 0$$

it can be easily shown that, after some algebraic simplifications: $$\left(\frac{T_{31}}{T_{21}}\right)'=y_1\det W_3$$

which yields that $$T_{31}=AT_{21}$$ for some non-zero constant $$A$$. This in turn can be manipulated, using the identity above, into the form

$$\left(\frac{y_3}{y_1}\right)'-A\left(\frac{y_2}{y_1}\right)'=0\iff y_3-Ay_2-By_1=0$$

and hence there exist non-zero constants that render the functions linearly independent.

Note: We had to assume in the above proof that all sub-Wronskians are non-vanishing. This is the reason why proofs involving Wronskians are usually inductive in the dimension of the linear vector space. If a sub-Wronskian is zero, it is trivial to see that the determinant of the Wronskian will be zero if one has proven it for all dimensions smaller than that. The only non-trivial case can be shown as above for any dimension $$n$$.

• This appears to only use linear algebra but it should need more. Is there a reference for this proof? In 2) in the backwards direction, you get $c_i$ as functions by linear algebra, there is a nontrivial step to show that the $c_i$ are actually constant.
– blue
Jul 11, 2020 at 15:45
• It is a "sketch" of a proof as mentioned above. You're right that it requires more than linear algebra, but all there is to it is taking some derivatives and taking cases regarding the $c_i$'s being zero or non-zero which shows that they are all constant. I don't have a reference because I cooked it up from my basic knowledge of Wronskians and linear dependence. Jul 15, 2020 at 17:59
• @blue I edited with an idea that could be made into a precise proof. Jul 15, 2020 at 20:57

Without the need for other technology, it follows from the existence and uniqueness theorem for solutions of differential equations (Cauchy-Lipschitz, or Picard-Lindelöf, according to sources) in $$\mathbb{R}^n$$. Write the system in the linearized form $$\begin{cases} y'=z\\ z' = -y \end{cases}$$ (this is clearly equivalent to $$y''=-y$$, after introducing an auxiliary variable).

Let $$y(x)$$ (together with $$z(x)=y'(x)$$) be any solution of this system of differential equations with initial values $$y(0)=y_0,z(0)=z_0$$.

Then, you can find $$c_1,c_2$$ such that the function $$\hat{y}(x) = c_1 \sin x + c_2 \cos x$$ solves the differential equation and has the same initial conditions $$\hat{y}(0)=y_0, \hat{y}'(0) = z_0$$. Hence, by the uniqueness theorem, $$y(x)=\hat{y}(x)$$, which is the result you need.

• Does the uniqueness theorem apply even when no initial conditions are given?
– Max
Jul 15, 2019 at 23:04
• @Max They are given here when I apply it! It's in the last paragraph. Jul 16, 2019 at 6:21
• @Max no, Cauchy-Lipschitz/Picard-Lindelöf theorem require initial values. Otherwise there is an infinity of solutions. May 25, 2021 at 12:09

Consider the initial value problem $$y'' = -y$$, with $$y(0) = 0$$ and $$y'(0) = 0$$. Multiplying both sides by $$2y'$$, $$2y'' y' = -2y y' \implies ((y')^2)' = -(y^2)' \implies (y')^2 + y^2 = C$$ for some constant $$C$$. Applying the initial values yields $$C = (y'(0))^2 + (y(0))^2 = 0.$$ Thus, $$0 = (y')^2 + y^2 \ge y^2 \ge 0 \implies y = 0.$$ Hence, the initial value problem has only the unique solution $$y = 0$$.

Now, fix $$a, b \in \Bbb{R}$$ and consider two solutions $$y_1$$ and $$y_2$$ of the initial value problem $$y'' = -y$$ with $$y(0) = a$$ and $$y'(0) = b$$. Let $$y = y_1 - y_2$$. Then, $$y'' = (y_1 - y_2)'' = y_1'' - y_2'' = -y_1 + y_2 = -y.$$ Further, $$y(0) = y_1(0) - y_2(0) = a - a = 0$$ and similarly $$y'(0) = 0$$. Hence, $$y$$ satisfies the original initial value problem, thus $$y = 0$$ by the previous result, hence $$y_1 = y_2$$.

That is, we can choose $$a$$ and $$b$$ as we like, and we obtain at most one solution given the initial values. In particular, we can define $$\sin$$ with $$a = 0$$ and $$b = 1$$ and $$\cos$$ with $$a = 1$$ and $$b = 0$$.

Note that this doesn't guarantee a solution to the differential equation, but it's a way to get uniqueness.

Starting from $$y'' = -y$$, we can add $$y$$ to form

$$y'' + y = 0$$

This is a homogeneous second order linear differential equation which we can simplify by writing the characteristic polynomial as

$$r^2 + 1 = 0$$

or

$$r = \pm i$$

which are distinct roots. The general solution can be written as

$$y(x) = c_1\sin(x) + c_2\cos(x)$$

This tells us that $$y_1 = \sin(x)$$ is a solution and so is any constant multiple of it, such as $$c_1\sin(x)$$. Similarly, $$y_2 = \cos(x)$$ is another solution (and so is any function of the form $$c_2\cos(x)$$). So, by the principle of superposition, we can add $$c_1\sin(x)$$ and $$c_2\cos(x)$$ to form the general solution.

As any linear combination of $$c_1\sin(x)$$ + $$c_2\cos(x)$$ works, it is clear that $$\sin(x)$$ and $$\cos(x)$$ cannot be the only solutions.

Principle of Superposition: If $$y_1$$ and $$y_2$$ are any two solutions of the homogeneous equation $$y′′ + p(x)y′ + q(x)y = 0$$. Then any function of the form $$y = c_1 y_1 + c_2 y_2$$ is also a solution of the equation, for any pair of constants $$c_1$$ and $$c_2$$.

Remark: However, while the general solution of $$y′′ + p(x)y′ + q(x)y = 0$$ will always be in the form of $$c_1 y_1 + c_2 y_2$$, where $$y_1$$ and $$y_2$$ are some solutions of the equation, the converse is not always true. Not every pair of solutions $$y_1$$ and $$y_2$$ could be used to give a general solution in the form $$y = c_1 y_1 + c_2 y_2$$.

You claim that $$\sin(x)$$ and $$\cos(x)$$ are the only solutions. Instead, you should focus on linear combinations of these:

$$y_1 = \cos(x)$$ $$y_2 = \sin(x)$$ $$y_3 = \sin(x) + \cos(x)$$ $$y_4 = 2\sin(x) + 3\cos(x)$$ $$y_5 = \sin(x) + i\cos(x)$$ $$y_6 = 10\sin(x) - 11i\cos(x)$$

among many others where $$y_i = c_1\sin(x) + c_2\cos(x)$$ for constant $$c_1,c_2$$.

• Thanks for your response. However, my question asks how we know that sine, cosine, and linear combinations thereof are the only solutions.
– Max
Jul 15, 2019 at 1:55
• Because we have a homogeneous second order linear differentiation equation where the general solution is $y(x) = c_1\sin(x) + c_2\cos(x)$. Therefore, the solutions must be linear combinations of $\sin(x)$ and $\cos(x)$. To apply the existence and uniqueness theorem of solutions we would observe that for $y′′ + p(x)y′ + q(x)y = 0$, both $p(x)$ and $q(x)$ are continuous as they are 0 and 1. Then, alongside initial conditions we could show that there exists a unique solution. Jul 15, 2019 at 2:10
• @Axion004 But there might be another obscure function $f$ which makes the even more general solution $y(x) = c_1 sin(x) + c_2 cos(x) + c_3 f(x)$. How do we know resp. how can we be sure that no such function (being linear independent from $sin$ and $cos$) exists? Jul 16, 2019 at 7:21
• @glglgl Because $y''+y=0$ is a homogeneous second order linear differentiation equation. If it was nonhomogeneous, such as $y''+y=\sin(2x)$, then we would need to solve for $c_3$. See math24.net/topics-second-order-differential-equations, math24.net/…, and math24.net/… for a practical summary. Jul 16, 2019 at 13:49

Suppose $$y=y(t)$$ is a solution. We can solve this by subtitutions. Let the parameter of the following functions ($$x,y,r,\theta$$, to be introduced later) be $$t$$. Consider the substitution $$x=y'$$. Then this becomes a system of equations: $$x'=-y,\quad y'=x$$ By another substitution $$x=r\cos\theta,\ y=r\sin\theta$$ we get $$r'=0,\quad \theta'=1$$ (I don't have a pen now so maybe this could be $$-1$$ instead) Solve this you get $$r=c_1,\ \theta=t+c_2$$ and the original solution is $$y=r\sin\theta=c_1\sin(t+c_2)$$ which is a linear combination of $$\sin$$ and $$\cos$$

• I'm very fond of this answer since it relies only on concepts that a first-time DE student is likely to know. But can anyone vouch for the validity of this argument? Is it circular, given that it invokes the sine and cosine functions that we are in fact trying to define?
– Max
Jul 15, 2019 at 23:08
• @Max I would say that it is circular in the way you describe. Jul 16, 2019 at 2:35
• @Max Please correct me if I am wrong. I believe proving "sin and cos can be defined by $y''=-y$" is equivalent to proving "$y = A\sin x+B\cos x$ under our usual definition of sin and cos $\iff y$ is a solution of $y''=-y$". So I have to invoke sin and cos (under the usual definition), and those are the sin and cos used in my proof. Otherwise one could simply say: "Let's forget all about sin and cos we have learned, and call the solutions of $y''=-y$ sin and cos!", in which case there's nothing to prove. Jul 16, 2019 at 5:08

If you're comfortable with exponentials of linear maps/matrices, then this answer might be helpful.

Theorem: Let $$A \in M_{n \times n}(\Bbb{R})$$ be a given $$n \times n$$ matrix, and consider the differential equation $$\xi' = A \xi$$. Then, every solution $$f: \Bbb{R} \to \Bbb{R}^n$$ of this ODE is of the form \begin{align} f(t) = \exp(tA) \cdot \eta \end{align} for some $$\eta \in \Bbb{R}^n$$. (the $$\cdot$$ that appears here is matrix multiplication)

There are a couple of facts you need to know. The first is that for any $$t \in \Bbb{R}$$, the matrix $$\exp(tA)$$ is invertible and its inverse is $$\exp(-tA)$$. So, to prove this theorem, let $$f: \Bbb{R} \to \Bbb{R}^n$$ be any solution to the above ODE. Define a new function $$g: \Bbb{R} \to \Bbb{R}^n$$ by \begin{align} g(t) = \exp(-tA) \cdot f(t) \end{align} Now, you need to know a bit about multivariable calculus and the "generalised product rule", and you also need to know how to differentiate matrix exponentials. The results are pretty much the same as in single variable calculus, but their proofs require a bit more care. We have that for every $$t \in \Bbb{R}$$, \begin{align} g'(t) &= \left(\exp(-tA) \cdot (-A) \right) \cdot f(t) + \exp(-tA) \cdot f'(t) \\ &= - \exp(-tA) \cdot A \cdot f(t) + \exp(-tA) \cdot \left(A \cdot f(t) \right) \\ &= 0 \tag{\ddot{\smile}} \end{align} In the first line I used the product rule and the rule for differentiating matrix exponentials. In the second line, I used the fact that $$f' = A \cdot f$$ (by assumption).

Now, $$(\ddot{\smile})$$ says that the derivative of $$g$$ is always $$0$$. Hence, (by a corollary of the mean-value inequality) there is a vector $$\eta \in \Bbb{R}^n$$ such that for all $$t \in \Bbb{R}$$, \begin{align} g(t) = \eta \tag{*} \end{align} In other words, we have shown that $$g$$ is a constant function. Multiplying both sides of $$(*)$$ by $$\exp(tA)$$ immediately gives us that for all $$t$$, $$f(t) = \exp(tA) \cdot \eta$$, which is what we wanted to prove.

If this is unfamiliar, I suggest, you consider the special case $$n=1$$, so that there are no matrices, and everything is just multiplication by real numbers.

To apply this general result to your specific question, we take $$n=2$$, and consider the ODE $$\xi' = A \xi$$, where $$A$$ is the $$2 \times 2$$ matrix \begin{align} A = \begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix} \end{align} If you write out the equation $$\xi' = A \xi$$ in components, we get \begin{align} \begin{cases} \xi_1' &= \xi_2 \\ \xi_2' &= -\xi_1 \end{cases} \end{align} Differentiating the first again, and substituting into the second gives us $$\xi_1'' = -\xi_1$$, which is exactly what you asked (you just wrote $$y'' = -y$$ instead). It is sometimes helpful to consider a second order ODE as 2 first-order ODE's as I have done.

By what I proved above, we know that every solution to this ODE is of the form $$\exp(tA) \cdot \eta$$, for some $$\eta \in \Bbb{R}^2$$. You can verify that the matrix exponential in this case is given by \begin{align} \exp \begin{pmatrix} 0 & t \\ -t & 0 \end{pmatrix} &= \begin{pmatrix} \cos t & \sin t \\ -\sin t & \cos t \end{pmatrix} \end{align}

Hence, the multiplying out the solution gives \begin{align} \begin{pmatrix} \xi_1(t) \\ \xi_2(t) \end{pmatrix} &= \begin{pmatrix} \cos t & \sin t \\ -\sin t & \cos t \end{pmatrix} \cdot \begin{pmatrix} \eta_1 \\ \eta_2 \end{pmatrix} \\ &= \begin{pmatrix} \eta_1 \cos(t) + \eta_2 \sin(t) \\ -\eta_1 \sin(t) + \eta_2 \cos(t) \end{pmatrix} \end{align}

Hence, the solution to $$y'' = -y$$ (which I apologise, but in my notation is $$\xi_1'' = -\xi_1$$) is given by a linear combination of sines and cosines: \begin{align} \xi_1(t) = \eta_1 \cos(t) + \eta_2 \sin(t), \end{align} for some $$\eta_1,\eta_2 \in \Bbb{R}$$.

To learn about matrix exponentials and their properties, and how to compute them, I suggest you take a look at Hirsch and Smale's book "Differential Equations, Dynamical Systems and Linear Algebra".

Intuitively, we can tell that $$sin(x)$$ and $$cos(x)$$ and all their multiples and linear combinations would be part of the solution since differentiating them twice gives us the same thing. E.g -> $$(sin(x))''=-sin(x)$$ and $$(cos(x))''=-cos(x)$$ But you suggest that functions of the form $$y = \frac{1}{g(x)}$$ can be possible, where $$g(x)$$ is a polynomial of degree $$>=2$$, so that when it is differentiated twice, the derivative is not $$0$$. Here's why this is not a possible function: $$y'=-\frac{g(x)'}{g(x)^2}$$ $$y''=\frac{2}{g(x)^3}-\frac{g(x)''}{g(x)^2}$$ Now $$y''=-y$$ suggests $$-\frac{1}{g(x)}=\frac{2}{g(x)^3}-\frac{g(x)''}{g(x)^2}$$ multiplying by $$g(x)^2$$, $$-g(x)=\frac{2}{g(x)}-g(x)''$$ Substituting $$y=1/g(x)$$, $$-g(x)=2y-g(x)''$$, which means, $$y=\frac{g(x)''-g(x)}{2}\neq\frac{1}{g(x)}$$ Thus, this rules out all functions of the form $$y=1/g(x)$$.

• But it is a linear combination of $\sin(x)$ and $\cos(x)$. Jul 15, 2019 at 1:20
• This doesn’t answer the question, why does it have so many upvotes?
– cmk
Jul 15, 2019 at 1:35
• @cmk It was written before linear combinations were mentioned in the question. Check out the revision history. Despite not using the correct nomenclature, I still think the asker was clearly asking for something different to this. Jul 15, 2019 at 1:41
• Yes, I wrote "constant multiples" when I meant "linear combinations" in the original post. My goal is to understand how the equation $y'' = -y$ can define the sine and cosine functions. @programmingandroid's most recent edit addresses the $y=1/g(x)$ case, but this still doesn't establish that there are no other solutions. (I had in mind something more like $y=f(x)/g(x) + h(x)$ where all of $f$, $g$, and $h$ are polynomials of varying degrees. Of course, I expect this form to fail, too.)
– Max
Jul 15, 2019 at 1:53

Assume a solution for $$y$$ will be proportional to $$e^{mx}$$ for a constant $$m$$. This means $$\frac{d^2}{dx^2} (e^{mx}) + e^{mx} = 0 \to m^2 e^{mx} + e^{mx} = 0$$

The only solutions to this are $$m = \pm i$$. This means that $$y = c_1 e^{ix} + c_2e^{-ix} = c_1(\cos(x)+i\sin(x)) + c_2(\cos(x)-i\sin(x))$$

This equals $$y = (c_1+c_2)\cos(x) + i(c_1-c_2)\sin(x)$$

Renaming the variables finds $$y = d_1\cos(x)+d_2\sin(x)$$

• This gets you all solutions that are of the form of a linear combination of exponentials; why are all solutions of that form? You need a more abstract theorem to actually answer this question.
– Ian
Jul 15, 2019 at 1:16

Note that $$y=0$$ is trivial solution. Also, $$sinx$$ and $$cosx$$ both satisfy the homogeneous ODE $$y''+y=0$$ and $$\frac{sinx}{cosx}\ne$$ constant hence both are linearly independent solutions of given ODE of second order. So the solution space (a vector space in itself of dimension $$2$$) must have basis $$B=$${$$sinx,cosx$$}. Claiming another $$y*$$ as a solution of given ODE will eventually lead to $$y*=c_1cosx+c_2sinx$$ where $$c_1$$ and $$c_2$$ are arbitrary constants.