Solve for: y '+2xy=x

Expression: $y '+2xy=x$

Since the equation is written in standard form, determine the functions $P\left( x \right)$ and $Q\left( x \right)$

$\begin{array} { l }P\left( x \right)=2x,\\Q\left( x \right)=x\end{array}$

Insert the function $P\left( x \right)=2x$ into the formula for the integrating factor $u\left( x \right)$

$\begin{array} { l }u\left( x \right)={e}^{\int{ 2x } \mathrm{d} x},\\Q\left( x \right)=x\end{array}$

Evaluate the integral

$\begin{array} { l }u\left( x \right)={e}^{\left( {x}^{2} \right)},\\Q\left( x \right)=x\end{array}$

Insert the integrating factor $u\left( x \right)$ and the function $Q\left( x \right)$ into the general solution formula

$y=\frac{ 1 }{ {e}^{\left( {x}^{2} \right)} } \times \int{ x{e}^{\left( {x}^{2} \right)} } \mathrm{d} x$

Evaluate the integral

$\begin{array} { l }y=\frac{ 1 }{ {e}^{\left( {x}^{2} \right)} } \times \left( \frac{ {e}^{\left( {x}^{2} \right)} }{ 2 }+C \right),& C \in ℝ\end{array}$

Multiply each term in the parentheses by $\frac{ 1 }{ {e}^{\left( {x}^{2} \right)} }$

$\begin{array} { l }y=\frac{ 1 }{ {e}^{\left( {x}^{2} \right)} } \times \frac{ {e}^{\left( {x}^{2} \right)} }{ 2 }+\frac{ 1 }{ {e}^{\left( {x}^{2} \right)} } \times C,& C \in ℝ\end{array}$

Cancel out the common factor ${e}^{\left( {x}^{2} \right)}$

$\begin{array} { l }y=\frac{ 1 }{ 2 }+\frac{ 1 }{ {e}^{\left( {x}^{2} \right)} } \times C,& C \in ℝ\end{array}$

Calculate the product

$\begin{array} { l }y=\frac{ 1 }{ 2 }+\frac{ C }{ {e}^{\left( {x}^{2} \right)} },& C \in ℝ\end{array}$