# Integration by parts with CDF

I am told that the following equality follows from integration by parts:

$$\int_{R-k}^{1}(\theta-R)dG(\theta)-G(R-k)k=\int_{R-k}^{1}(1-G(\theta))d\theta-k$$ Where $$R>k>0$$ and $$G$$ is the CDF of $$\theta$$ which is distributed on $$[0,1]$$. Can someone explain how integration by parts has been used here? Thank you.

Hint: Simply apply integration by parts to the integral on the LHS. Simplify and you should arrive at the following expression: $$$$(1-R)-\int_{R-k}^1G(\theta)\mathrm d\theta.$$$$ Add and subtract $$k$$ to obtain: $$$$(1-R+k-k)-\int_{R-k}^1G(\theta)\mathrm d\theta = (1-(R-k))-k-\int_{R-k}^1G(\theta)\mathrm d\theta.$$$$ Observe that $$(1-(R-k))=\int_{R-k}^1(1)\mathrm d\theta$$. Substitute that in and collect terms, you'll get the RHS expression.