First, subtract #color(red)(2h)# from each side of the equation to isolate the #w# term while keeping the equation balanced:
#p - color(red)(2h) = 2w + 2h - color(red)(2h)#
#p - 2h = 2w + 0#
#p - 2h = 2w#
Now, divide each side of the equation by #color(red)(2)# to solve for #w# while keeping the equation balanced:
#(p - 2h)/color(red)(2) = (2w)/color(red)(2)#
#(p - 2h)/2 = (color(red)(cancel(color(black)(2)))w)/cancel(color(red)(2))#
#(p - 2h)/2 = w#
#w = (p - 2h)/2#
Or
#w = p/2 - (2h)/2#
#w = p/2 - (color(red)(cancel(color(black)(2)))h)/color(red)(cancel(color(black)(2)))#
#w = p/2- h#