Finding the original ODE using a solution Does there exist a linear-homogeneous ODE with constant coefficients so that
$$y(x) = x \cos^2(x)-\sin(x)$$
is its solution?
If it does exist, how can I know what the original ODE is
or how can I say there's no such ODE?
I've tried changing $y(x)$ to
$$y(x) =x \, (\cos(2x)+1)-\sin(x) \\
y(x) = x \, \cos(2x)+x-\sin(x).$$
Now I've figured few things:

*

*that if $y(x) =x \, \cos(2x)+x-\sin(x)$ is a solution
then $y(x) = x + \cos(2x) - \sin(x)$ is also a solution


*because the solution consist of $\cos$ and $\sin$ then the roots of the ODE must consist of a root with the form $k=a+bi$ and $k=a-bi$.
Other than that I'm pretty stuck with how I should move forward from here.
Edit:
Correct answer after confirming with WolfarmAlpha

 A: Notice that:
$$y(x) = x \cos^2(x)-\sin(x) = \frac{x\cos(2x)}{2} + \frac{x}{2} - \sin(x).$$
I assume that the starting ODE is linear, time-invariant and homogeneous.
Let $D(\lambda)$ be the characteristic polynomial of the ODE such that $y(x)$ is one solution. According to the form of $y(x)$, we can observe that:

*

*$D(\lambda)$ has $(\lambda^2 + 4)^2$ as factor in order to have $x\cos(2x)$ in the solution;

*$D(\lambda)$ has $\lambda^2$ as factor in order to have $x$ in the solution;

*$D(\lambda)$ has $(\lambda^2 + 1)$ as factor in order to have $\sin(x$) in the solution.

Accordingly, the characteristic polynomial can (I guess it is minimal) be:
$$D(\lambda) = \lambda^2(\lambda^2 + 4)^2(\lambda^2 + 1) = \lambda^8 + 9 \lambda^6 + 24 \lambda^4 + 16 \lambda^2,$$
corresponding to the linear, time-invariant and homogeneous ODE
$$y^{(8)}(x) + 9y^{(6)}(x) + 24y^{(4)}(x) + 16y^{(2)}(x) = 0,$$
where $y^{(n)}(x)$ is the $n$-th derivative of $y(x)$.
The general solution of such ODE is:
$$y(x) = A+Bx + C\cos(2x) + D\sin(2x) + Ex\cos(2x) + Fx\sin(2x) + G\cos(x) +H\sin(x),$$
and the solution proposed by the OP corresponds to the case where:
$$\begin{cases}
A = 0\\
B = \frac{1}{2}\\
C = 0\\
D = 0\\
E = \frac{1}{2}\\
F = 0\\
G = 0\\
H = -1
\end{cases}$$
In a Cauchy problem context, the parameters $A, B, \ldots, H$ are determined by the provided initial condition.
