# Check $\;y=\dfrac{\sin x}{x}\;$ is solution of $\;xy'+y=\cos x\;$

How can I check that $\;y=\dfrac{\sin x}{x}\;$ is a solution of $\;xy'+y=\cos x\;$?

-
Take the derivative of y and then check that the left side equals the right side (you might have to do some simplifications and algebra). Make sense? – Amzoti Dec 17 '12 at 1:14
Ah yea..Of course. Sometimes the solution is so simple that I tend to overlook it. Thanks. – Kyle H Dec 17 '12 at 1:18

Using the quotient rule for differentiation, we have $$xy'+y=x\left(\frac{x\cos x-\sin x}{x^2}\right)+y=\cos x-\frac{\sin x}{x}+\frac{\sin x}{x}=\cos x.$$

-
Very nice, thank you. – Kyle H Dec 17 '12 at 1:15

Compute $y'$ using $$y=\dfrac{\sin x}{x},\tag{1}$$

Substitute your result, $y'$, into the equation $$xy'+y=\cos x,\tag{2}$$

Evaluate, and check to confirm that the left-hand side of $(2)$ equals the right-hand side of $(2)$.

-
Thanks for the help! – Kyle H Dec 17 '12 at 1:31

One can always check whether a function "works" by substituting. In this case, we can do better. For note that $xy'+y=(xy)'$. So our equation can be rewritten as $$(xy)'=\cos x.$$ Integrate. We get $xy'=\sin x +C$ and therefore the general solution is $$\frac{\sin x +C}{x}.$$

-

In case you wanted to know how to arrive at the solution. Since this is a linear equation of order one:

$$y'x+y=\cos x\Longrightarrow y'+\frac{1}{x}y=\frac{\cos x}{x}$$

We now put

$$\mu(x):=e^{\int\frac{dx}{x}}=e^{\log x}=x\Longrightarrow$$

The general solution is

$$y=\frac{1}{x}\left(\int\frac{\cos x}{x}\cdot e^{\int\mu(x)dx}dx\right)+C=\frac{1}{x}\int\cos xdx+C=\frac{\sin x}{x}+C\,\,,\,C=\,\text{a constant}$$

-

Just differentiate $\Rightarrow xy=\sin(x)$

applying uv rule on L.H.S and $\sin$ derivative on R.H.S

$\Rightarrow xy'+ y=\cos( x)$

-