Answer
$u = t^3-t^2$
Work Step by Step
A first-order linear differential equation is one that can be put into the form:
$\frac{dy}{dx} + P(x)~y = Q(x)$
We can consider the given equation:
$t\frac{du}{dt} = t^2+3u$, $~~~~t \gt 0$
$\frac{du}{dt}-\frac{3}{t}u = t$
Let $P(t) = -\frac{3}{t}$
Let $Q(t) = t$
We can find the integrating factor:
$I(x) = e^{\int -\frac{3}{t} ~dt} = e^{-3~ln~t} = e^{ln~t^{-3}} = \frac{1}{t^3}$
We can multiply by the integrating factor:
$\frac{1}{t^3}~\frac{du}{dt}-\frac{3}{t^4}~u = \frac{1}{t^2}$
$\frac{d}{dt}(\frac{1}{t^3}~u) = \frac{1}{t^2}$
We can integrate both sides of the equation:
$\frac{1}{t^3}~u = \int \frac{1}{t^2}~dt$
$\frac{1}{t^3}~u = -\frac{1}{t}+C$
$u = -t^2+Ct^3$
We can use the initial condition to find $C$:
$u(2) = 4$
$-(2)^2+C(2)^3 = 4$
$-4+8C = 4$
$C = 1$
We can write the solution:
$u = t^3-t^2$