# Peculiarities in the evaluation of $y'=\frac{2y}x$?

The equation $$y'=\frac{2y}x$$ has the obvious solution of $$kx^2$$, which exists for all reals, regardless of the values of $$k$$. This having been said, it is obvious via the differential equation that $$y'(0)$$ is undefined, which creates some oddities in creating numerical solutions to the curve. To be brief, my question is as follows:

Seeing as $$y' = \frac{2y}x$$ does in fact have the solution $$kx^2$$, and that $$\frac{d}{dx}(kx^2) = 2kx$$, why does the first formulation fail to fully explain the solution curve, and is one more "correct" than the other in terms of both accuracy and mathematical precedent?

## 3 Answers

A key thing in differential equations, which is sometimes glossed over is that in order to specify a differential equation and its solution, the domains have to be stated explicitly. This is usually clear from context, but let me spell out what kinds of details are (sometimes) left implicit in a discussion of ODEs. In the present example, let $$U = \{ (x,y) \in \mathbb{R^2}: x \neq 0\}$$, define the function $$F: U \to \mathbb{R}$$ by $$\begin{equation} F(x,y) = \dfrac{2y}{x} \end{equation}$$ So the differential equation we wish to study is $$y'(x) = F(x,y(x))$$. By definition, a solution to this differential equation is a function $$y: I \to \mathbb{R}$$, where $$I$$ is an interval in $$\mathbb{R}$$ such that

1. For every $$x \in I$$, $$(x,y(x)) \in U$$
2. For every $$x \in I$$, $$y'(x) = F(x,y(x))$$

Notice that lot of conditions have to be satisfied before we can call something a solution. First we need to specify a function $$y$$, which automatically means we have to specify its domain $$I$$, and target space. Next, we need to ensure that condition ($$1$$) is satisfied. BTW, note that condition ($$1$$) is not superfluous, it is absolutely essential to ensure that condition ($$2$$) makes sense (because otherwise $$(x,y(x))$$ will not be in the domain $$U$$ of $$F$$, so the RHS is not defined).

So, in your specific example, for every $$k \in \mathbb{R}$$, we can (for example) define a function $$y_k:(0, \infty) \to \mathbb{R}$$, by $$\begin{equation} y_k(x) = kx^2 \end{equation}$$ Then it is easy enough to see that conditions ($$1$$) and ($$2$$) are satsfied. Notice how I purposely excluded $$0$$ from the domain of $$y_k$$. When you said

"Seeing as $$y' = \dfrac{2y}{x}$$ does in fact have the solution $$kx^2$$ ..."

what you probably had in mind was the function $$g_k : \mathbb{R} \to \mathbb{R}$$, defined by $$g_k(x) = kx^2$$. Notice that even though $$g_k$$ and $$y_k$$ follow the same rule, they are strictly speaking different functions because their domains are different; and this makes all the difference, because for $$g_k$$, condition ($$1$$) is not satisfied, hence it is NOT a solution of the ODE above.

It is precisely to avoid issues/confusions you raised that we sometimes have to pay close attention to how things are defined, and to be cautious of domains etc. But once you are comfortable with keeping track of all these details, you can stop explicitly mentioning all of this, as long as there is little chance for ambiguity.

You haven't solved it though..

You've just stated a solution exists. If I gave you $$x^4=1$$ as an equation in $$\mathbb{C}$$, and you said that $$x=\pm 1$$ are the solutions, sure, you found some solutions. How do you know you found all of them? . In fact, $$y=ax^2$$ for $$x\ge0$$ and $$y=bx^2$$ for $$x<0$$ is the full solution set.

Now onto your actual question:

Why doesn't it fully characterise the solution set? The question should be why should it characterise the solution set? If you've done calculus, then differentiation and integration are known to be opposites. Yet there's a $$+C$$ in integration -- is any single value of the constant "more correct"? No, it's just "some unknown constant" -- any real number there would work. Similarly, in your case, any real numbers for $$k$$ works, and they're all fine.

We have, \begin{align} \frac{dy}{dx} &= \frac{2y}{x}\\ \Rightarrow \frac{1}{y} dy &= \frac{2}{x} dx\\ \Rightarrow \int \frac{1}{y} dy &= \int \frac{2}{x} dx\\ \Rightarrow \ln(y) &= \ln(x^2) + \ln(k)\\ \Rightarrow y &= k e^{\ln(x^2)} \end{align} Notice that $$\ln(x^2)$$ is undefined for $$x = 0$$, so really when we make the simplification $$e^{\ln(x^2)} = x^2$$ we should specify that $$x$$ is not allowed to be zero. Thus strictly speaking, the solution to the ODE is: $$y = kx^2 \qquad \forall 0 \ne x \in \mathbb{R}$$ Hope that somewhat answers your question.