I just started studying differential equations, and I can't solve the following:
$$x'-2xt=2te^{2t}$$
I know it is a linear ordinary differential equation, and to solve it I have to do the change of variables $x=ce^{\int_{t_0}^{t}2s ds}$. I want to find the general solution, so I can't subsitute $t_0$ for any value like $0$ or $1$. If I was given the value of the function for a $t_0$, meaning: $x(t_0)=x_0$. I would know how to proceed. What can I do?
Your ODE in the form of \begin{equation} x' + p(t)x = q(t) \end{equation} has the general solution is \begin{equation} x(t) = \frac{\int e^{\int p(t)}q(t) dt + C}{e^{\int p(t)}} \end{equation} where in your case, you have \begin{align} p(t) &= -2t \\ q(t) &= 2te^{2t} \end{align} The integration of $p(t)$ is \begin{equation} \int p(t) = -t^2 \end{equation} and hence \begin{equation} x(t) = \frac{2\int te^{-t^2+2t} dt + C}{e^{-t^2}} \tag{1} \end{equation} Notice that \begin{equation} \int te^{-t^2+2t} dt ={\displaystyle\int}\left(t-1\right)\mathrm{e}^{2t-t^2}\,\mathrm{d}t+{\displaystyle\int}\mathrm{e}^{2t-t^2}\,\mathrm{d}t \end{equation} The first integral is easy $\int f'e^{f} = e^{f}$and will give you \begin{equation} {\displaystyle\int}\left(t-1\right)\mathrm{e}^{2t-t^2}\,\mathrm{d}t =-\dfrac{\mathrm{e}^{2t-t^2}}{2} \end{equation} Now solving ${\displaystyle\int}\mathrm{e}^{2t-t^2}\,\mathrm{d}t$, you can complete the squares as such $${\displaystyle\int}\mathrm{e}^{2t-t^2}\,\mathrm{d}t={\displaystyle\int}\mathrm{e}^{1-\left(t-1\right)^2}\,\mathrm{d}t$$ Then do a change of variab;e $u = t-1$, to get \begin{equation} {\displaystyle\int}\mathrm{e}^{2t-t^2}\,\mathrm{d}t= =\dfrac{\sqrt{{\pi}}\mathrm{e}\operatorname{erf}\left(u\right)}{2} =\dfrac{\sqrt{{\pi}}\mathrm{e}\operatorname{erf}\left(t-1\right)}{2} \end{equation} Finally, we get \begin{equation} \int te^{-t^2+2t} dt =\dfrac{\sqrt{{\pi}}\mathrm{e}\operatorname{erf}\left(t-1\right)-\mathrm{e}^{2t-t^2}}{2}+C \end{equation}