Assistance solving $x'(t)=t-x(t)^2$

I'm taking a second level ODE class and for part of some problem I need to solve a nonlinear first-order differential equation, but I've never worked with nonlinear problems before (there was no prerequisite to the class for such).

I need assistance to solve $x'(t)=t-x(t)^2$ if someone can run me though the basics on how to get a solution. Thanks for any help in advance


As already commented, you are trying to solve a Ricatti differential equation which can be simplified into an Airy differential equation, whose solutions can not be expressed in terms of elementary functions.

One of the most general cases of the Ricatti differential equation is $$ x' = P(t) + Q(t)x + R(t)x^2. $$ For our case, $P(t) = t$, $Q(t) = 0$ and $R(t) = -1$. The transformation $$ w := -\frac{y'}{yR(t)} = \frac{y'}{y} $$ leads us to $$ \frac{y''}{y} - \frac{y'}{y^2}y' = t - \left(\frac{y'}{y}\right)^2 \Rightarrow y'' = ty, $$ which is the Airy differential equation with $k^2 = 1$. Their solutions are $$ y(t) = c_1\mathrm{Ai}(t) + c_2\mathrm{Bi}(t), $$ being $\mathrm{Ai}(x)$ and $\mathrm{Bi}(x)$ the Airy and Airy Bi functions, respectively. Retrieving our $x(t)$ variable and absorbing constants, finally we have $$ \boxed{x(t) = \frac{\mathrm{Ai}'(t) + c_1\mathrm{Bi}'(t)}{\mathrm{Ai}(t) + c_1\mathrm{Bi}(t)},} $$ with $$ c_1 = \frac{\mathrm{Ai}'(t_0) - x(t_0)\mathrm{Ai}(t_0)}{x(t_0)\mathrm{Bi}(t_0) - \mathrm{Bi}'(t_0)}\tag{1}\label{eq:constant} $$ for some fixed $x(t_0)$ value.

Here is a plot of the result setting $0 \le x(0) \le 2.5$ with steps of $0.25$.

Ricatti equation solution

For this case, you can simplify \eqref{eq:constant} since $$ \mathrm{Ai}(0) = \frac{1}{3^{2/3}\Gamma\left(\frac{2}{3}\right)}, \qquad \mathrm{Ai}'(0) = -\frac{1}{3^{1/3}\Gamma\left(\frac{1}{3}\right)}, \qquad \mathrm{Bi}(0) = \frac{1}{3^{1/6}\Gamma\left(\frac{2}{3}\right)}, \qquad \mathrm{Bi}'(0) = \frac{3^{1/6}}{\Gamma\left(\frac{1}{3}\right)}. $$