Selected Problems from
A First Course in Probability by Sheldon Ross

Problem 14 (Page 314)

pD = (1/(L^2)) (((d^2)/2) + 
                (d^2)) + ((2 d (L - 2  d))/(L^2))  + (1/(L^2)) ((L + d) L - ((L^2)/2) - (d + L) (L - d) + ((((L - d))^2)/2)) // 
        Simplify

Plot[pD /. {L -> 1}, {d, 0, 1}];

D[pD, d] // Simplify

Plot[Evaluate[D[pD, d] /. {L -> 1}], {d, 0, 1}];