a particle is projected up an inclined plane with initial velocity u m/s .the line of projection makes angle a with the horizontal and the inclined plane makes angle b with the horizontal. show that the range is a maximum when a=45°+b/2

so far I got the time of flight =

and i have gotten the range =

from here i cant see how to maximise this using differentiation or trigonometry.