Determine the values of $p$ and $q$ for which the following integral converges. $$\int_{0}^{\infty}\dfrac{x^{p-1}}{1+xq}dx$$
I used integration by parts and wrote $\infty$ as a limit of $a$ going to $\infty$ and the first half of the result is $$\lim_{a \to \infty} \left[\frac{x^p}{p}\cdot\frac{1}{1+xq}\right]_{0}^{a}$$
Both fractions should converge here resulting in $p < 1$ and $q < 0$.
Is this approach correct?
 A: Integration by parts is a potentially useful idea. However, the details have not been done, for there is a missing integral. 
The conclusion that $p\lt 1$ is correct, but we need to add that $p$ must be $\gt 0$. The conclusion about $q$ is not right. So we outline another approach. Let $f(x)$ be our function.
First let us deal with $q\lt 0$. Then $1+xq=0$ at $x=1/|q|$. So our function  blows up at $x=1/|q|$. The change of variable $u=1+xq$ will show that $\int_0^{1/|q|} \frac{x^{p-1}}{1+xq}\,dx$ does not exist.
Now let $q=0$. If $p-1\le -1$, then $\int_0^1 x^{p-1}\,dx$ does not exist, while if $p-1\ge -1$, then $\int_1^{\infty} x^{p-1}\,dx$ does not exist, so our full integral does not exist.
Finally, let $q\gt 0$. Then $\int_0^1 x^{p-1}\,dx$ exists if $p-1\gt -1$, and does not exist otherwise.  So finally we need to find the values of $p$ for which $\int_1^\infty f(x)\,dx$ exists. For $x\ge 1$ we have $1+qx\gt qx$. So if $p-1-1\lt -1$, then $\int_1^\infty f(x)\,dx$ exists. It is not hard to argue that if $p-1-1\ge -1$, then the integral does not exist.
To sum up, the integral exists precisely if $q\gt 0$ and $0\lt p\lt 1$. 
