How do I solve a first order differential equation of the following form

This is a linear differential equation so first let's find the solution to the homogenous equation. We see that $x(t)=A\exp(-\ln(t))=\frac{A}{t}$ where $A$ is a constant. Using a well-known method, we suppose that $A=A(t)$, so we have $x(t)=\frac{A(t)}{t}$. Using the equation, we get$$ A'(t)=t \exp(t^2) $$ so $A(t) = \frac{\exp(t^2)}{2}+C$ where $C$ is a constant. Thus $$ x(t)=\frac{\exp(t^2)}{2t}+\frac{C}{t}. $$


With this kind of problems, the standard approach is to start with finding a solution to the homogenous differential equation, and then add what's called a 'particular solution' for the inhomogenous part. If you're not familiar with this solving method, you should learn more about it very soon, it's quite common :)

For the homogenous equation: $x'(t) = -\frac{x(t)}{t}$ I used the so called 'separation of the variables' method: $\frac{dx}{x(t)} = -\frac{dt}{t}$

And came to the homogenous solution: $x(t) = \frac{c}{t}$ for some constant $c \in \mathbb{R}$.

Then, to find a particular solution (you only need one of them), I used the method of the variation of constants: $x(t) = \frac{1}{t}\left(c + \int_{0}^{t}x\cdot e^{x^2}dx\right)$

And finally found the following general solution to your ODE problem: $x(t) = \frac{1}{2}\cdot\frac{e^{t^2}}{t} + \frac{c}{t}$

So, I hope this will help you to understand the steps to follow! And I wrote my results so that you can check on your way :)


$$x'(t) + \frac{x(t)}{t} = e^{t^2}\tag1$$ It is a first order linear ODE. Integrating factor $~=e^{\int(1/t)dt}=e^{\ln t}=t~.$

Multiplying both side of $(1)$ with the integrating factor, we have $$tx'(t) + x(t)= te^{t^2}\tag2$$Integrating, $$\implies d\left(tx\right)=\int te^{t^2}~dt$$ $$\implies tx=\dfrac 12\int e^{t^2}~d(t^2)$$ $$\implies tx=\dfrac 12 e^{t^2}+c$$ $$\implies x(t)=\dfrac {e^{t^2}}{2t}+\dfrac{c}{t}$$where $c$ is integrating constant.