Showing the AM-GM inequality, $\textit{Problem From The Book}$, 19.17, but using integrals The chapter of this problem is Solving Elementary Inequality Using Integrals. After I typed the problem: I spent several hours trying to solve it, but to no avail, so I am hoping someone here can enlighten me.

For part $a$,I can prove AM-GM inequality by intgeral,But for Weighted AM–GM inequality I can't
My approach maybe
$$\dfrac{A}{G}-1=\sum_{i=1}^{k} r_i \int_{a_i}^{G} (\frac{1}{t} - \frac{1}{G}) dt + \sum_{i=k+1}^{n} r_i \int_{G}^{a_i} (\frac{1}{G} - \frac{1}{t}) dt $$
For part $b$: I can solve it(without use integral),because it must to prove
$$\dfrac{A}{A'}\ge\dfrac{G}{G'}$$ or
$$\dfrac{\sum_{i=1}^{n}r_{i}x_{i}}{\sum_{i=1}^{n}r_{i}(1-x_{i})}\ge \prod_{i=1}^{n}\left(\dfrac{x_{i}}{1-x_{i}}\right)^{r_{i}}$$
so we consider
$$f(x)=\ln{\dfrac{x}{1-x}}=\ln{x}-\ln{(1-x)}(0<x<0.5)$$
and
$$f'(x)=\dfrac{1}{x}+\dfrac{1}{1-x},f''(x)=-\dfrac{1}{x^2}+\dfrac{1}{(1-x)^2}<0(0<x<\frac{1}{2}$$
so By Jenson inequality
$$\sum_{i=1}^{n}r_{i}f(x_{i})\le f(\sum_{i=1}^{n}r_{i}x_{i})$$
so I have prove it part b,
But I can't prove part a
 A: $\newcommand{\d}{\,\mathrm{d}}$The first step is in evaluating $I$. Let's first note that each $x_i$ and $A$ itself are strictly positive so we only care about evaluating  $I$ in the case $x,a\gt0$. A partial fraction decomposition is in order - I leave the derivation at the bottom of the post for readability:
$$\frac{t}{(1+t)(x+at)^2}=\frac{x}{x-a}\cdot\frac{1}{(x+at)^2}+\frac{a}{(x-a)^2}\cdot\frac{1}{x+at}-\frac{1}{(x-a)^2}\cdot\frac{1}{1+t}$$
So:
$$\begin{align}I(x,a)&=\frac{x}{x-a}\int_0^\infty\frac{1}{(x+at)^2}\d t+\frac{1}{(x-a)^2}\int_0^\infty\left(\frac{a}{x+at}-\frac{1}{1+t}\right)\d t\\&\overset{u=at}{=}\frac{x}{x-a}\cdot\frac{1}{a}\int_0^\infty\frac{1}{(x+t)^2}\d t+\frac{1}{(x-a)^2}[\ln(x+at)-\ln(1+t)]_0^\infty\\&\overset{u=t+x}{=}\frac{x}{a(x-a)}\int_x^\infty\frac{1}{t^2}\d t+\frac{1}{(x-a)^2}\left[\lim_{t\to\infty}\ln\left(\frac{x+at}{1+t}\right)-\ln x\right]\\&=\frac{1}{a(x-a)}+\frac{1}{(x-a)^2}[\ln a-\ln x]\end{align}$$
Let's turn our attention to the summand: $$\begin{align}r_i(x_i-A)^2I(x_i,A)&=r_i(x_i-A)^2\left(\frac{1}{A(x_i-A)}+\frac{1}{(x_i-A)^2}\ln A-\frac{1}{(x_i-A)^2}\ln x_i\right)\\&=r_i\left(\frac{x_i}{A}-\frac{A}{A}+\ln A-\ln x_i\right)\\&=-r_i+\frac{1}{A}r_ix_i+\ln A\cdot r_i-r_i\ln x_i\end{align}$$
And let's sum, recalling that $\sum_{i=1}^nr_i=1$:
$$\begin{align}\sum_{i=1}^nr_i(x_i-A)^2I(x_i,A)&=-\sum_{i=1}^nr_i+\frac{1}{A}\sum_{i=1}^nr_ix_i+\ln A\cdot\sum_{i=1}^nr_i-\sum_{i=1}^nr_i\ln x_i\\&=-1+\frac{1}{A}(A)+\ln A-\sum_{i=1}^n\ln(x_i^{r_i})\\&=\ln A-\ln\left(\prod_{i=1}^nx_i^{r_i}\right)\\&=\ln\frac{A}{G}\end{align}$$
How do we conclude? Well, as $r_i,x_i,A\gt0$ always, the integral $I(x_i,A)$ is an integral of purely nonnegative terms and is thus nonnegative; $(x_i-A)^2\ge0$ since the squares of real numbers are nonnegative, and as said $r_i\gt0$ always, so each summand $r_i(x_i-A)^2I(x_i,A)\ge0$ for all $i$, so that: $$\begin{align}\ln\frac{A}{G}&=\sum_{i=1}^nr_i(x_i-A)^2I(x_i,A)\ge0\\\ln\frac{A}{G}&\ge0\\\frac{A}{G}&\ge1\\A&\ge G\quad\blacksquare\end{align}$$
And we are all done!
N.B. On the partial fraction decomposition:

$$\begin{align}\frac{t}{(1+t)(x+at)^2}&=\frac{A}{1+t}+\frac{B}{x+at}+\frac{C}{(x+at)^2}\\\implies t&=A(x+at)^2+B(1+t)(x+at)+C(1+t)\\\implies t&=Ax^2+Bx+C+2Aaxt+Bxt\\&+Bat+Ct+Aa^2t^2+Bat^2\\\implies\tag{1}0&=Ax^2+Bx+C=Ax+B+\frac{C}{x}\\\tag{2}0&=Aa^2+Ba=Aa+B\\\tag{3}1&=2Aax+Bx+Ba+C\end{align}$$
Through comparing coefficients in $1,t,t^2$. Let's use $(1)$ to say that $Ax=-B-\frac{C}{x}$ and use $(2)$ to say that $Aa=-B$, and substitute them into $(3)$: $$\begin{align}\tag{4}1&=2(Aa)x+Bx+Ba+C\overset{(2)}{=}-2Bx+Bx+Ba+C\\&=Ba-Bx+C\\\tag{5}1&=2a(Ax)+Bx+Ba+C\overset{(3)}{=}-2Ba-2a\frac{C}{x}+Bx+Ba+C\\&=Bx-Ba+C\cdot\frac{x-2a}{x}\end{align}$$Now add $(4),(5)$ and note the $Ba-Ba,Bx-Bx$ cancel: $$\tag{6}2=C+C\cdot\frac{x-2a}{x}=C\cdot\frac{2x-2a}{x}\implies C=\frac{x}{x-a}$$Let's put this into $(4)$: $$1=B(a-x)+\frac{x}{x-a}\implies B=\frac{1}{a-x}\cdot\frac{(x-a)-x}{x-a}=\frac{a}{(x-a)^2}$$And finally let's use $(2)$ to say that: $$A=-\frac{B}{a}=-\frac{1}{(x-a)^2}$$

A: Part b only
Let $ x_i ' = 1 - x_i$, so $ A' = 1-A$.
Clearly $ x_i' \geq \frac{1}{2} \geq x_i$ and $ A' \geq \frac{1}{2} \geq A$.
Notice that $x_i - A = -( 1 - x_i ) + (1-A) = -x_i' + A'$, so $(x_i - A) ^2 = ( x_i ' - A')^2$.
For $ x' \geq x$ and $A' \geq A$ , it is clear that $I(x', A') \leq I(x, A) $ (by looking at the intergration term). Hence,
$$ \ln \frac{A}{G} = \sum r_i ( x_i - A) ^2 I (x_i , A ) \geq \sum r_i (x_i ' - A' ) ^2 I ( x_i', A ')  = \ln \frac{ A'}{G'} .$$
Thus, by the monotonicity of the ln function, $ \frac{A}{G} \geq \frac{A'}{G'}$.
Equality holds iff $ x_i = \frac{1}{2}$.
