# Finding a first order or second order linear ODE with solution $y=\cos(x)$

I am trying to find a linear ODE ($y'+ay=0$ or $y''+ay'+by=0$) with solution $y=\cos(x)$. However, I need to find the linear ODE with the minimum order as possible which has this solution. I know $y''+y=0$ has solution $y=A\cos(x)+B\sin(x)$ where $A$ and $B$ are both constants.Is there any first order ODE with solution $y=\cos(x)$, and if there is no such an equation, how to proof that? Thanks in advance.

A first order DE with constant coefficients cannot have $\cos x$ as a solution. However, consider the linear first-order DE $$y'+(\tan x) y=0.$$ If $x$ is suitably restricted, this has $y=\cos x$ as a solution.
• How can I prove that there is no first order DE with constant coefficients with $y=\cos(x)$ as solution? Nov 30, 2015 at 16:56
• This was answered by Michael. Look at $y'+ay=0$ where $a$ is a constant. The general solution of this is $y=Ce^{-ax}$ for some constant $C$. And $Ce^{-ax}$ cannot be identically equal to $\cos x$, even in a neighbourhood of $0$. This is clear if $C=0$ or $a=0$. And otherwise, $\cos x$ has zero derivative at $0$ but $Xe^{-ax}$ doesn't. Nov 30, 2015 at 17:05
If $a$ is constant, then $y(x)=Ae^{-ax}$, and is either always zero or never zero.
If $a$ is not constant, then you know $y$ and $y'$, so...
$$y=cosx$$ $$y'=-sinx$$ $$y'+y=cosx-sinx$$ $$y'+y=cosx-sqr.rt1+cos^2x$$ $$y'+sqr.rt1+cos^2x=0$$ $$y'+sqr.rt y^2=0$$