I have a differential equation: $$y(x)\frac{dy(x)}{dx}+nxy(x)=C,$$ where $n$ and $C$ are constants. Is there a way to get $y(x)$ ?
How to solve the first order ODE
205 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
On
It's not difficult to see how Wolfram Alpha got its solution. Rewrite the differential equation as $$\frac{d y}{d x}=\frac C y - n x.$$ We can get a function with a simpler derivative by taking $t:=nx^2+2y$: $$\frac{d t}{d x}=2nx + 2(\frac C y - n x) = \frac{2C} y.$$ Then by the inverse function theorem, $$\frac{d x}{d t}=\frac{y}{2C} = \frac{t}{4C} - \frac{n}{4C} x^2.$$ This is a Riccati equation for $x$ with independent variable $t$, so substitute $$x=4C\left.\frac{d z}{d t} \right/ nz$$ to get $$ \frac{d^2 z}{d t^2} = \frac{n}{16 C^2} t z. $$ If $t$ is rescaled by $$q:=\left(\frac n {16C^2}\right)^{1/3},$$ this is an Airy equation for $z$, so it has solution $z={\cal A}(qt)$, for $\cal A$ a solution to the Airy equation (it can be any linear combination of Ai and Bi with constant coefficients.) Unwinding our substitutions, we get $$nx {\cal A}(qt)=4 q C {\cal A}'(qt),$$ or $$nx {\cal A}(q(nx^2+2y))=4 q C {\cal A}'(q(nx^2+2y)).$$ This is the solution given by Wolfram Alpha. It's an implicit solution, as it's in the form of an equation involving $x$ and $y$.
Saw this, and I have a thing for differential equations so I thought I'd jump in - would love to get discussion going! We have $$ y(x) \frac{dy(x)}{dx} + nxy(x) = C $$ Which I'll write $$ y \frac{dy}{dx} + nxy = C $$ to save on some keystrokes.
Something that comes to mind is to divide by $y$ such that $$ y \frac{dy}{dx} + nxy = C \rightarrow \frac{dy}{dx} + nx = C\frac{1}{y} = Cg(x) = Cg $$ Here, I defined $g = g(x) = 1/y(x)$ which I think is a reasonable step as long as we are take into account later on that this is not valid when $y(x) = 0$.
But if we continue, we have $$ \frac{dy}{dx} + nx = Cg $$ or $$ \frac{dy}{dx} = Cg - nx $$
This expression is now integrable on both sides, thus $$ \int \frac{dy}{dx} dx = \int (Cg - nx) dx $$ $$ = \int dy = y = \int Cg dx - \int nx dx = C\int g(x) dx - \frac{n}{2}x^2 + D $$ Where $D$ is some other constant that can be determined given a set of favourable initial conditions. We thus end up with $$ y(x) = C\int g(x) dx - \frac{n}{2}x^2 + D $$
Leaving us with
What do yall think?