Another way of solving the differentialequation Solve the problem : 
$$ \begin{cases}
 \frac{dx}{dt} + \frac{1}{t} \cdot x = {e^t}^2 , t>0 \\[2ex]
x(1) = 1  \end{cases}$$
I have solved it by restructuring which gives : 
$$\frac{d}{dt} \cdot (tx) ={e^t}^2 \cdot t  $$
Some calculations later we will have the solution : 
$$ x(t) = \frac {1}{t}(\frac{{e^t}^2}{2} - \frac{e}{2} + 1)$$
I know there is another way of solving this problem, finding the general further the complete solution. $\frac{dx}{dt} = C{e}^{ln(t)} $ further put C = Z(t) and try to find x(t). I need some help and learn that way too. 
Thank you in advance. 
 A: The method I think you're referring to uses an integrating factor (which is basically what you've done). If you have the 1st order linear ODE
$$ y'(t) + p(t) y(t) = g(t) $$
Then define
$$ \mu(t) = \exp \left ( \int p(t) dt \right ) $$
and you can deduce that
$$ \frac{d}{dt} ( \mu(t) y(t) ) = g(t) \mu(t) $$ 
is the same as the ODE since $\mu(t) \neq 0$. Thus the solution to 1st order linear ODE is always
$$ y(t) = \frac{1}{\mu(t)} \int g(t) \mu(t) dt $$
A: $$ \frac{dx}{dt} + \frac{1}{t} \cdot x = {e^t}^2$$,Which is linear in $x$, Hence $IF=e^{\int\frac{1}{t}dt}=e^{\ln t}=t$,Therefore solution is given by,
$$x.IF=\int {e^t}^2.IFdt+C$$
$$xt=\int {e^t}^2tdt+C$$, which gives $2xt={e^t}^2+2C,$ Now use initial condition to get value of $C$, and hence find final solution
A: you can also solve the differential equation by the method of variation of parameters. here is how it goes: solve the associated homogeneous problem
$$\frac{dx}{dt} + \dfrac x t= 0 \to \frac {dx} x + \frac{dt} t= 0\to \ln x + \ln t = \ln c \to x = \frac c t\tag 1 $$ 
now look for a particular solution of the nonhomogenous  problem $$\frac{dx}{dt} + \dfrac x t= e^{t^2} \tag 2$$ in the form of $(1)$ with the form of $c$ to determined.
taking the derivative of $(1)$ and subbing in $(2),$ we find that $c$ satisfies $$ \frac 1 t \frac{dc}{dt}-\frac c{t^2} +\frac c{t^2} =  e^{t^2} \to dc = te^{t^2}\, dt \to c = \frac 12 e^{t^2}, x_p =\frac 12 \frac{ e^{t^2}}t\tag 3 $$
the general solution is $$x = \frac 12 \frac{ e^{t^2}}t+\frac c t, \text{ where $c$ is a constant.}  $$
you can use the initial condition $x = 1$ at $t = 1$ to determine the value of $c.$
