I came across this ODE:

$$2xy'(x)-y(x)=\log(x),\quad x>0 \tag{1}$$

Now one sees that the inhomogeneous part is an Euler-Differential-Equation. In fact, the nice way to solve this would probably be to use the substitution $x=e^t$ and $h(t)=y(e^t)$ since the problem here seems to be the inhomogeneity, which is $\log(x)$.

When I initially saw the problem, I didn't like the $\log(x)$ inhomogeneity, since I don't have any tools to solve such a thing. So I tried to get rid and saw that if I differentiate the ODE and multiply it with $x$, I'll get a very nice form:


We differentiate $(1)$ and multiply with $x$.

$$2y'-2xy''-y'=1/x\tag{2}\quad\Rightarrow\quad xy'-2x^2y''=1$$

Homogeneous: We use the ansatz $y=x^\lambda$ to get $$P(\lambda)=\lambda-\lambda(\lambda-1)=2\lambda-\lambda^2=\lambda(2-\lambda)=0 \quad \Rightarrow \quad \lambda_1=0, \lambda_2=\frac{1}{2} \tag{3}$$

So we get $$y_h=A+B\sqrt{x} \tag{4}$$

Particular: Using a theorem from the Book Analysis 1 - Königsberger (see below) we get the particular solution:


General Solution: So we find: $$y=A+B\sqrt{x}+\frac{1}{2}x$$

Question: Now I am very unsure if the whole "I differentiate the original equation and solve the resulting" actually works. I'd assume I now should divide by $x$ and integrate, but I just can't get it to work so I guess the whole idea is flawed?

Theorem: Let $P(D)y=q$ (this is just the operator notaton) be our diff. eq. With $q$ having the form: $$q(x)=(b_0+b_1x+\dots+b_mx^m)e^{\mu x}$$ and let $\mu$ be a k-th root of $P$ (think: the char. poly. found in the homogeneous part) whereas $k=0$ means $P(\mu)\neq 0$. Then, $P(D)y=q$ has a solution of the form

$$y_p(x)=(c_0+c_1x+\dots +c_mx^m)x^ke^{\mu x}$$

If $m=0$ we can further say:

$$y_p=\frac{b_0}{P^{(k)}(\mu)}x^k e^{\mu x}$$

  • 1
    $\begingroup$ Did you test your solution? I don't think it is correct. The solution should be $y(x)=A\sqrt{x}-\log(x)-2$ for $A$ a constant. $\endgroup$ – user526015 Jan 16 '19 at 10:42
  • $\begingroup$ Yeah and it isn't correct. That's the problem. I can get that by using the substitution in the beginning but if I try the approach of deriving it, I don't get a valid solution - letting me think, the whole idea is wrong. $\endgroup$ – xotix Jan 16 '19 at 10:50
  • $\begingroup$ $(2xy')'=2y'\color{red}+2xy''$. Note that$$y'-\frac y{2x}=\frac{\log x}{2x}$$is just a first order linear differential equation which can be solved by multiplying with the integrating factor$$e^{\displaystyle\int\frac{-1}{2x}dx}$$ $\endgroup$ – Shubham Johri Jan 16 '19 at 11:01
  • $\begingroup$ Mind telling us how you got $y_p=x/2$? You probably made an error in finding $y_p$, because $x/2$ doesn't satisfy $(2)$ $\endgroup$ – Shubham Johri Jan 16 '19 at 11:16
  • $\begingroup$ I added the theorem I used. Hope it's clear. I usually work a lot with it (since you can also allow $\mu\in\mathbb C$ and thus handle a lot of more inhomogenities. The $-$ above is of course wrong, using the proper equation I get $y_p=-x$ which also seems to be wrong. $\endgroup$ – xotix Jan 16 '19 at 12:34

$$(2xy')'=2y'\color{red}+2xy''$$You will obtain$$2x^2y''+xy'=1\tag{a}$$giving the value of $\lambda$ as $0,1/2$. This means$$y_h=A+B\sqrt x$$which you found correctly. I am not sure what theorem you are referring to for solving for $y_p$, but you probably made a mistake because $x/2$ doesn't satisfy $(\mathrm a)$. I will use the method of variation of parameters to arrive at the general solution here.

$$W(1,\sqrt x;x)=\begin{vmatrix}1&\sqrt x\\0&\frac1{2\sqrt x}\end{vmatrix}=\frac1{2\sqrt x}\\A(x)=-\int\frac{2\sqrt x\sqrt x}{2x^2}dx=-\log x+C_1\\B(x)=\int\frac{2\sqrt x}{2x^2}dx=-\frac2{\sqrt x}+C_2\\\therefore y=-\log x+k_1\sqrt x+k_2$$Note here that $y_p=-\log x$, as it turns out.

The solution isn't over. The general solution of a first order ODE involves only one arbitrary constant, but the general solution we obtained contains two. This is because what we found is the general solution to the second order ODE given in $(\mathrm a)$. Observe that while all the functions that satisfy the original ODE will also satisfy the ODE you got by differentiating it, all the solutions of the latter are not solutions of the former. Differentiating an ODE introduces extraneous solutions. For a simpler example, consider the ODE$$y'=2$$with the general solution $y=2x+c'$. Differentiating it yields the ODE$$y''=0$$the general solution of which is $y=kx+c''$.

In other words, the set of solutions we are looking for is a proper subset of the set of functions of the form $-\log x+k_1\sqrt x+k_2$. We need to reject the extraneous solutions.

The general solution of the original ODE entails one particular and one homogeneous solution. Note that $\sqrt x$ is a solution of the associated homogeneous equation$$2xy'-y=0$$so we are looking for a particular solution of the form$$y_p=-\log x+k_2$$Substituting in $2xy_p'-y_p=\log x$ gives the value of $k_2=-2$, so the desired answer is$$y=-\log x-2+c\sqrt x$$

Remark. You might notice that the approach you followed is workable but rather inefficient and long-drawn. The given ODE can be written as$$y'-\frac y{2x}=\frac{\log x}{2x}$$which is a first order linear differential equation, which can be solved by multiplying with the integrating factor$$e^{\int-\frac1{2x}dx}=\frac1{\sqrt x}\\\frac{y'}{\sqrt x}-\frac y{2x\sqrt x}=\frac{\log x}{2x\sqrt x}\\\therefore\frac d{dx}\Big(\frac y{\sqrt x}\Big)=\frac{\log x}{2x\sqrt x}$$Now integrate both sides. You can integrate the RHS by parts to obtain $$\frac y{\sqrt x}=-\frac{\log x}{\sqrt x}-\frac2{\sqrt x}+c$$

  • $\begingroup$ Very nice, thanks! I added the theorem. $\endgroup$ – xotix Jan 16 '19 at 12:34

Let me give you a different approach to solve this differential equation. We are given $$2x\frac{d}{dx}y(x)-y(x)=\log(x).$$ Start by dividing everything by $2x$. This gives $$\frac{d}{dx}y(x)-\frac{y(x)}{2x}=\frac{\log(x)}{2x}.$$ Now multiply both sides by $\frac{1}{\sqrt{x}}.$ You will then see that is a good idea to substitute $\frac{d}{dx}\left(\frac{1}{\sqrt{x}}\right)=-\frac{1}{2x^{3/2}}$. Finally, applying the product rule gives you something that you can integrate on both sides and evaluate. Can you fill the intermediate steps and guess, why multiplication by $\frac{1}{\sqrt{x}}$ was the right idea?

Let me know and if you can't manage, I'll be happy to fill the intermediate steps and give more explanation.

  • $\begingroup$ The approach does work $\endgroup$ – Shubham Johri Jan 16 '19 at 11:09
  • $\begingroup$ @ShubhamJohri It does? Then I'm sorry and there has to be an error in the calculations that were performed by the op. $\endgroup$ – user526015 Jan 16 '19 at 11:12
  • $\begingroup$ It works, even though it is inefficient and lengthy. See my answer for more details $\endgroup$ – Shubham Johri Jan 16 '19 at 12:06

After substitution $x=e^t,\;t=\log{x}$ we have ODE with constant coefficients: $$2y'-y=t$$ Solution is $$y=Ce^{t/2}-t-2=C\sqrt{x}-\log{x}-2$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.