Here is the trick: set Y = x - q(x) Then observe Y is uniform [0,1/n] so the PDF of Y = n. After that just do simple formula plug in!!
Here is the trick: set Y = x - q(x) Then observe Y is uniform [0,1/n] so the PDF of Y = n. After that just do simple formula plug in!!