Here is Canvas object wihch demonstrate the problem.

Bending moments Ma and Mb produce compression normal stress (shown in green) above the z centroidal axis. Tension normal stress (shown in blue) is developed in the lower portion. The bending stresses are linearly distributed.

Investigating shear in beams