Find the least order differential equation that accepts $y=a\cos{(\ln{x})}+b\sin{(\ln{x})}$ general solution. There are two coefficients but I found the least order differential equation as first order one. When I put the given general solution to the differential equation that I found, It provides the equation.
Here's how I found the differential equation:
$$y=a\cos{(\ln{x})}+b\sin{(\ln{x})} \Rightarrow y\prime=-\frac{a}{x}\sin{(\ln{x})}+\frac{b}{x}\cos{(\ln{x})}$$
Multiply both sides with $\frac{ax}{b}$,
$$\frac{ax}{b}y\prime=-\frac{a^2}{b}\sin{(\ln{x})}+a\cos{(\ln{x})}$$
$$a\cos{(\ln{x})}=y-b\sin{(\ln{x})}\Rightarrow\frac{ax}{b}y\prime=-\frac{a^2}{b}\sin{(\ln{x})}+y-b\sin{(\ln{x})}$$
$$\frac{ax}{b}y\prime=y-\left(\frac{a^2+b^2}{b}\right)\sin{(\ln{x})}$$
Multiply both sides with $\frac{b}{ax}$ to simplify,
$$y\prime=\frac{b}{ax}y-\frac{a^2+b^2}{ax}\sin{(\ln{x})}$$
$$y\prime-\frac{b}{ax}y=-\frac{a^2+b^2}{ax}\sin{(\ln{x})}$$
The last formula is the first order differential equation that I found. When I put the given solution and it's derivative, it provides the eqution. Is my solution correct? Or should have I found second order differential equation for some reason, because there are 2 coefficients, a and b?
 A: You have to eliminate both constants $a$ and $b$. Better to rewrite the solution as :
$$y=a\cos{(\ln{x})}+b\sin{(\ln{x})}$$
$$y=a\cos{(t)}+b\sin{(t)}$$
With $x=e^t$.
Then the characteristic polynomial is
$$r^2+1=0$$
And the DE is:
$$y''(t)+y(t)=0$$
And
$$\dfrac {dy}{dt}=\dfrac {dy}{dx}\dfrac {dx}{dt}=x\dfrac {dy}{dx}$$
$$\dfrac {d^2y}{dt^2}=x\dfrac {d}{dx} \left (x\dfrac {dy}{dx} \right)=......$$
The differential equation becomes:
$$x^2y''+xy'+y=0$$
A: In order to answer the question you address as a comment:
Let us work somehow backwards. If, in your first degree equation
$$y^\prime-\frac{b}{ax}y=-\frac{a^2+b^2}{ax}\sin{(\ln{x})}\tag{1}$$
you plug
$$y=A\cos{(\ln{x})}+B\sin{(\ln{x})}\tag{2}$$
(please note that I have taken variables capital $A,B$):
$$-A\sin{(\ln{x})}+B\cos{(\ln{x})}\dfrac{1}{x}-(A\cos{(\ln{x})}+B\sin{(\ln{x})})\frac{b}{ax}=-\frac{a^2+b^2}{ax}\sin{(\ln{x})}$$
otherwise said:
$$-aA\sin{(\ln{x})}+aB\cos{(\ln{x})}-bA\cos{(\ln{x})}-bB\sin{(\ln{x})}=-(a^2+b^2)\sin{(\ln{x})}$$
You see that, identifying the LHS and the RHS:
$$aA+bB=-(a^2+b^2)  \ \ \text{and} \ \ aB-bA=0$$
a linear system whose solutions are $A=a$ and $B=b$.
It is in this particular case
Therefore a possible answer to your question is that the set of functions (2) is the solution of the whole family of differential equations (1), for all possible $a,b$.
