S=lw+wh+hl
We nave two equations here
S = w + wh + h and -S = w + wh + h
simplify
S - w = wh + h -S - w = wh + h
factor out h on the right
S - w = h(w + 1) -(S + w) = h(w + 1)
divide both sides by (w + 1)
[ S - w ] / [ w + 1] = h and -[S + w]/ [w + 1] = h
