Question:
I am trying to solve a principal value integral involving a square root. Using Mathematica I can get an answer but I would like to know a general approach to obtain them by hand. To be clear I am interested in a clear explanation of the method not just the solution.
The principal value integral is of the form: $$ I_{B}\left(y\right)=\frac{1}{\pi} \int_0^B J\left(x\right)\left(\frac{\mathcal{P}}{x+y}+\frac{\mathcal{P}}{x-y}\right)\mathrm{d}x,$$ where $\mathcal{P}$ denotes a principal value integral and $0\le y\le B$ (we only consider real numbers). I would be interested in a method of solution for $J\left(x\right)$ given by: $$J\left(x\right)=x\sqrt{B^2-x^2}.$$
Using Mathematica I have ascertained that $I\left(y\right)=\frac{B^2}{2}-y^2$ and since $J\left(x\right)$ is odd we have: $$ I_{B}\left(y\right)=\frac{1}{\pi} \int_{-B}^B J\left(x\right)\frac{\mathcal{P}}{x-y}\mathrm{d}x,$$ so I wonder if it could be solved with something akin to contour integration but I am at a loss as to how to proceed further.
Context:
The integral is required to map spectral densities of Hamiltonians used in Open Quantum Systems.
Bonus:
I will accept any answer that provides a step-by-step (analytic) method of solution for $I$ but I would also be interested in methods of solution for a couple of other integrals. I can post these as a separate question if people prefer.
Firstly: $$ L_{\left(C,D\right)}\left(y\right)=\frac{1}{\pi} \int_{C}^{D} J_2\left(x\right)\frac{\mathcal{P}}{x-y}\mathrm{d}x,$$ with $0\le C<y<D$, all positive real numbers and: $$J_2\left(x\right)=\sqrt{\left(D-x\right)\left(x-C\right)}.$$ Unfortunately, I have been unable to compute $L$ with Mathematica, but I have used alternative methods to ascertain $L_{\left(C,D\right)}\left(y\right)=\frac{C+D}{2}-y$.
And also: $$ K_{\left(A,B\right)}\left(y\right)=\frac{1}{\pi} \int_{A}^{B} J_1\left(x\right)\left(\frac{\mathcal{P}}{x+y}+\frac{\mathcal{P}}{x-y}\right)\mathrm{d}x,$$ with $0\le A<y<B$ all positive real numbers and: $$J_1\left(x\right)=\sqrt{\left(B^2-x^2\right)\left(x^2-A^2\right)}.$$ Since: $$ \frac{1}{\pi} \int_{A}^{B} J_1\left(x\right)\left(\frac{1}{x+y}+\frac{1}{x-y}\right)\mathrm{d}x=\frac{1}{\pi} \int_{A}^{B} J_1\left(x\right)\frac{2x}{x^2-y^2}\mathrm{d}x=\frac{1}{\pi} \int_{A^2}^{B^2} J_1\left(\sqrt{w}\right)\frac{1}{w-y^2}\mathrm{d}x=L\left(y^2\right)=\frac{A^2+B^2}{2}-y^2,$$ where we have used the substitution $w=x^2$ and defined $C=A^2$ and $D=B^2$.
It is probably also worth noting that: $$ L_{\left(C,D\right)}\left(y\right)=\frac{1}{\pi} \int_{0}^{D-C} \sqrt{w}\sqrt{D-C-w}\frac{\mathcal{P}}{w-(y-C)}\mathrm{d}w,$$ which can be found using the substitution $w=x-C$.
The evaluation of the Cauchy principal value integral via contour integration is relatively straightforward. To begin, consider the contour integral
$$\oint_C dz \, \frac{z \sqrt{z^2-B^2}}{z-y} $$
where $C$ is the following contour:
There are semicircular detours of radius $\epsilon$ around the branch points at $z=\pm B$ and the pole at $z=y$. Also, the large circle has a radius $R$. The pieces of the contour integral as labeled in the figure are as follows. (Yes, there are a lot of pieces, but as you will see, most will vanish or cancel.)
$$\int_{AB} dz \frac{z \sqrt{z^2-B^2}}{z-y} = \int_{-R}^{-B-\epsilon} dx \frac{x \sqrt{x^2-B^2}}{x-y}$$
$$\int_{BC} dz \frac{z \sqrt{z^2-B^2}}{z-y} = i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \, \frac{(-B+\epsilon e^{i \phi})\sqrt{(-B+\epsilon e^{i \phi})^2-B^2}}{-B+\epsilon e^{i \phi}-y} $$
$$\int_{CD} dz \frac{z \sqrt{z^2-B^2}}{z-y} = \int_{-B+\epsilon}^{y-\epsilon} dx \frac{x \sqrt{x^2-B^2}}{x-y} = \int_{-B+\epsilon}^{y-\epsilon} dx \frac{x i \sqrt{B^2-x^2}}{x-y}$$
$$\int_{DE} dz \frac{z \sqrt{z^2-B^2}}{z-y} = i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \, \frac{(y+\epsilon e^{i \phi})\sqrt{(y+\epsilon e^{i \phi})^2-B^2}}{\epsilon e^{i \phi}} \\ = i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \, \frac{(y+\epsilon e^{i \phi})i \sqrt{B^2-(y+\epsilon e^{i \phi})^2}}{\epsilon e^{i \phi}}$$
$$\int_{EF} dz \frac{z \sqrt{z^2-B^2}}{z-y} = \int_{y+\epsilon}^{B-\epsilon} dx \frac{x \sqrt{x^2-B^2}}{x-y} = \int_{y+\epsilon}^{B-\epsilon} dx \frac{x i \sqrt{B^2-x^2}}{x-y}$$
$$\int_{FG} dz \frac{z \sqrt{z^2-B^2}}{z-y} = i \epsilon \int_{\pi}^{-\pi} d\phi \, e^{i \phi} \, \frac{(B+\epsilon e^{i \phi}) \sqrt{(B+\epsilon e^{i \phi})^2-B^2}}{B+\epsilon e^{i \phi}-y} $$
$$\int_{GH} dz \frac{z \sqrt{z^2-B^2}}{z-y} = \int_{B-\epsilon}^{y+\epsilon} dx \frac{x \sqrt{x^2-B^2}}{x-y} = \int_{B-\epsilon}^{y+\epsilon} dx \frac{x (-i) \sqrt{B^2-x^2}}{x-y}$$
$$\int_{HI} dz \frac{z \sqrt{z^2-B^2}}{z-y} = i \epsilon \int_{0}^{-\pi} d\phi \, e^{i \phi} \, \frac{(y+\epsilon e^{i \phi})\sqrt{(y+\epsilon e^{i \phi})^2-B^2}}{\epsilon e^{i \phi}} \\ = i \epsilon \int_{0}^{-\pi} d\phi \, e^{i \phi} \, \frac{(y+\epsilon e^{i \phi})(-i) \sqrt{B^2-(y+\epsilon e^{i \phi})^2}}{\epsilon e^{i \phi}} $$
$$\int_{IJ} dz \frac{z \sqrt{z^2-B^2}}{z-y} = \int_{y-\epsilon}^{-B+\epsilon} dx \frac{x \sqrt{x^2-B^2}}{x-y} = \int_{y-\epsilon}^{-B+\epsilon} dx \frac{x (-i) \sqrt{B^2-x^2}}{x-y}$$
$$\int_{JK} dz \frac{z \sqrt{z^2-B^2}}{z-y} = i \epsilon \int_{0}^{-\pi} d\phi \, e^{i \phi} \, \frac{(-B+\epsilon e^{i \phi})\sqrt{(-B+\epsilon e^{i \phi})^2-B^2}}{-B+\epsilon e^{i \phi}-y} $$
$$\int_{KL} dz \frac{z \sqrt{z^2-B^2}}{z-y} = \int_{-B-\epsilon}^{-R} dx \frac{x \sqrt{x^2-B^2}}{x-y}$$
$$\int_{LA} dz \frac{z \sqrt{z^2-B^2}}{z-y} = i R \int_{-\pi}^{\pi} d\theta \, e^{i \theta} \frac{R e^{i \theta} \sqrt{R^2 e^{i 2 \theta}-B^2}}{R e^{i \theta}-y} $$
Note that, on the branch above the real axis, $-1=e^{i \pi}$ and on the branch below the real axis, $-1=e^{-i \pi}$. Thus, the sign of $i$ in front of the square root when $|x| \lt B$ is positive above the real axis and negative below the real axis.
First, note that the integrals over $AB$ and $KL$ cancel because the square root does not introduce any phase change there.
Second, as $\epsilon \to 0$, the integrals over $BC$, $FG$, and $JK$ vanish.
Third, as $\epsilon \to 0$, the integrals over $DE$ and $HI$ cancel. In this case, the phase difference over the branch cut due to the square root turns what is normally a constructive interference (i.e., the contributions usually add) into a destructive interference (i.e., they cancel.)
Fourth, as $\epsilon \to 0$, the integrals over $CD$ and $EF$ combine to form
$$i PV \int_{-B}^B dx \frac{x \sqrt{B^2-x^2}}{x-y}$$
and the integrals over $GH$ and $IJ$ combine to form
$$-i PV \int_{B}^{-B} dx \frac{x \sqrt{B^2-x^2}}{x-y}$$
so together, the contribution to the contour integral over these four intervals is
$$i 2 PV \int_{-B}^B dx \frac{x \sqrt{B^2-x^2}}{x-y}$$
Fifth, the final contribution to the contour integral is the integral over $LA$ in the limit as $R \to \infty$. That limit is evaluated as follows:
$$\begin{align} \int_{LA} dz \frac{z \sqrt{z^2-B^2}}{z-y} &= i R \int_{-\pi}^{\pi} d\theta \, e^{i \theta} \frac{R e^{i \theta} \sqrt{R^2 e^{i 2 \theta}-B^2}}{R e^{i \theta}-y} \\ &= i R^2 \int_{-\pi}^{\pi} d\theta \, e^{i 2 \theta} \left (1-\frac{B^2}{R^2 e^{i 2 \theta}} \right )^{1/2} \left (1-\frac{y}{R e^{i \theta}} \right )^{-1} \\ &= i R^2 \int_{-\pi}^{\pi} d\theta \, e^{i 2 \theta} \left [1+y \frac{1}{R e^{i \theta}} -\left (\frac{B^2}{2} - y^2 \right ) \frac1{R^2 e^{i 2 \theta}} + O \left ( \frac1{R^3} \right ) \right ]\end{align}$$
After integration, the first two contributions inside the brackets vanish. Further, as $R \to \infty$, all terms $O(1/R^3)$ will also vanish. This simply leaves the $1/R^2$ term in the integrand, and we may finally write an expression for the contour integral:
$$\oint_C dz \, \frac{z \sqrt{z^2-B^2}}{z-y} = i 2 PV \int_{-B}^B dx \frac{x \sqrt{B^2-x^2}}{x-y} - i 2 \pi \left (\frac{B^2}{2} - y^2 \right )$$
By Cauchy's theorem, the contour integral is equal to zero. Therefore, when $y \in (-B,B)$
as asserted by the OP.
ADDENDUM
The case $|y| \gt B$ is a straightforward application of the residue theorem and the result is
$$\frac1{\pi} \int_{-B}^B dx \frac{x \sqrt{B^2-x^2}}{x-y} = \sqrt{y^2-B^2} \left (y - \sqrt{y^2-B^2} \right ) - \frac{B^2}{2}$$