The gender divide

We know that more boys studying physics and science than girls, and women working in the field are outnumbered significantly, but is this because men have brains genetically built to be good at physics or because girls and women are not socially expected to thrive in these careers?  And beside where do trans people fit into this picture?