Finding function based on slope and point 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?
 A: $$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|}$$
A: You have some confusion in the use of the constant of integration.
1) Wan you integrate $$\frac{dy}{y} = \frac{xdx}{1+x^2}$$ you cannot write the constant $K$ on both sides ($A+K= B+K$ is the same as $A=B$ without $K$), so this step is:
$$\ln |y|  = \ln|\sqrt{1+x^2}| + K$$
2) exponentiating this equation you have:
$$\ y = \exp(\ln|\sqrt{1+x^2}| + K)=\exp(\ln|\sqrt{1+x^2}|)\times \exp(K)=$$
$$
=C\exp(\ln|\sqrt{1+x^2}|)
$$
where $C=\exp(K)$ is a new constant.
3) from the initial condition you can find
$$
3=C\exp(\ln|\sqrt{1+0}|)=C
$$
