Divide [0,1] into N subintervals using .

Let and let p,q be constant functions over [0,1].

I'm trying to find the piecewise solution to the integral . The solution is given in my notes without any explanation so I must be missing something because I'm not sure how to do it.

If someone can show me how to find e.g. then I should be able to do the rest. I can see that the solution will only be non-zero in the region |i-j|=1 and i=j but I'm struggling from here.