If I was given a function with the same degree on both sides (in this case 1)
$$\int \frac{x}{2 \sqrt{x+2}} dx$$
How would I Integrate this using Integration By Parts?
I thought it would be like: $$\frac{1}{2} \int x(x+2)^{-1/2} dx$$ and $u$ would be $x$, $dv$ would be $x(x+2)^{1/2} dx$. But after some trial and error I found that its not.
EDIT: Can a Mod correct the title with $P(x) = Q(x)$
The trick is to "kill" the factor "killable" by derivation and to integrate the factor which is easily integrable.
Considering your exercise, let's define $f(x)=x$ and $g(x)=(x+2)^{-1/2}$. Then you can "kill" $f(x)$ by derivation, because $f'(x)=1$, and you can easily integrate $g(x)$, because $$\int (x+2)^{-1/2} dx= \frac{(x+2)^{-\frac{1}{2}+1}}{-\frac{1}{2}+1}+c=2\sqrt{x+2}+c$$
Then
$$\int \frac{x}{2 \sqrt{x+2}} dx = \frac{1}{2} \int x(x+2)^{-1/2} dx = \frac{1}{2} \left[ x \left(2\sqrt{x+2} \right) - \int 2\sqrt{x+2} dx \right]$$
And you are done, since $$\int 2\sqrt{x+2} dx = 2\frac{(x+2)^{\frac{1}{2}+1}}{\frac{1}{2}+1} +c = \frac{4}{3}(x+2)^{\frac{3}{2}}+c$$
Then the final solution is
$$x\sqrt{x+2}-\frac{2}{3}(x+2)\sqrt{x+2} +c= \sqrt{x+2} \left( x-\frac{2}{3}(x+2) \right) +c=\frac{1}{3} \sqrt{x+2}(x-4) +c$$