We are given the differential equation as \(x \frac{d y}{d x}+2 y=x^{2}\).
First, we will convert our differential equation into the linear form.
We have:
\(x \frac{d y}{d x}+2 y=x^{2}\)
Dividing both the sides by \(x\), we get,
\(\Rightarrow \frac{d y}{d x}+\frac{2 y}{x}=x\)
So, comparing with \(\frac{d y}{d x}+P y=Q\), we get,
\(P=\frac{2}{x}\) and \(Q=x\).
Now, to solve further we will find the integrating factor.
The integrating factor is given as
\(I.F.=e^{\int P\ d x}\)
As, \(P=\frac{2}{x}\), so we get,
\(\Rightarrow I . F.=e^{\int \frac{2}{x} d x}\)
As, \(\int \frac{1}{x} d x=\log x\), so we get,
\(\Rightarrow I. F.=e^{2 \log x}\)
As, \(n \log x=\log x^{n}\), so we get,
\(\Rightarrow I. F.=e^{\log x^{2}}\)
Now, we know that,
\(e^{\log x}=x, e^{\log x^{2}}=x^{2}\), so we get,
\(\Rightarrow I .F.=x^{2}\)
Now, we know the solution is given as,
\(y \times I. F.=\int(Q \times I. F.) d x+C\)
As, \(I.F.=x^{2}, Q=x\), so we get,
\(\Rightarrow y x^{2}=\int\left(x \times x^{2}\right) d x\)
\(\Rightarrow y x^{2}=\int x^{3} d x\)
As, \(\int x^{n} d x=\frac{x^{n+1}}{n}\), so,
\(\Rightarrow y x^{2}=\frac{x^{4}}{4}+C\)
Dividing both the sides by \(x^{2}\), we get,
\(\Rightarrow y=\frac{x^{2}}{4}+\frac{C}{x^{2}}\)
Now, we have \(y(1)\) as 1, i.e., \(y(1)=1\).
So, putting \(x=1\) and \(y=1\), we get,
\(\Rightarrow 1=\frac{1^{2}}{4}+\frac{C}{1^{2}}\)
\(\Rightarrow 1=\frac{1}{4}+\frac{C}{1}\)
\(\Rightarrow 1=\frac{1}{4}+C\)
Solving for \(C\), we get,
\(\Rightarrow C=1-\frac{1}{4}=\frac{3}{4}\)
\(\Rightarrow C=\frac{3}{4}\)
So, putting it in the value of \(y\), we get,
\(\Rightarrow y=\frac{x^{2}}{4}+\frac{3}{4 x^{2}}\)