I have to find the equation of the function given the following information:
$$f(0) = 3 \ \ \ ; \ \ \ \frac{dy}{dx} = \frac{xy}{1+x^2}$$
So:
$$\frac{dy}{y} = \frac{xdx}{1+x^2}$$
Integrate:
$$\ln |y| + K = \ln|\sqrt{1+x^2}| + K$$
$$y = \sqrt{1+x^2} + K$$
Plug in values to find K
$$3 = \sqrt{1+0^2} + K \ \ \ ; \ \ \ K = 2$$
$$y = \sqrt{1+x^2} + 2$$
Answer in the book is
$$y = 3\sqrt{1+x^2}$$
Where did I go wrong?
$$y'(x)=\frac{xy(x)}{1+x^2}\Longleftrightarrow$$ $$\frac{y'(x)}{y(x)}=\frac{x}{1+x^2}\Longleftrightarrow$$ $$\int\frac{y'(x)}{y(x)}\space\text{d}x=\int\frac{x}{1+x^2}\space\text{d}x\Longleftrightarrow$$ $$\ln\left|y(x)\right|=\frac{\ln\left|x^2+1\right|}{2}+\text{C}\Longleftrightarrow$$ $$\left|y(x)\right|=\exp\left[\frac{\ln\left|x^2+1\right|}{2}+\text{C}\right]\Longleftrightarrow$$ $$\left|y(x)\right|=\exp\left[\text{C}\right]\exp\left[\frac{\ln\left|x^2+1\right|}{2}\right]\Longleftrightarrow$$ $$\left|y(x)\right|=\text{C}\exp\left[\frac{\ln\left|x^2+1\right|}{2}\right]\Longleftrightarrow$$ $$\left|y(x)\right|=\text{C}\sqrt{\left|1+x^2\right|}$$
Now, use $y(0)=3$:
$$\left|3\right|=\text{C}\sqrt{\left|1+0^2\right|}\Longleftrightarrow$$ $$3=\text{C}\sqrt{1}\Longleftrightarrow$$ $$3=\text{C}\cdot1\Longleftrightarrow$$ $$3=\text{C}\Longleftrightarrow$$ $$\text{C}=3$$
So:
$$\left|y(x)\right|=3\sqrt{\left|1+x^2\right|}$$