In collisions between molecules, energy, linear momentum, and angular momentum are all conserved. In cases where the two molecules actually collide, there should be two sets of momenta which can fill fit these equations, one of which is the original set of momenta, the other is the momenta after the collision. To get a general solution to the collision equations, one can therefore solve the following equations. (All molecules have a mass of one, so .)
These equations can be solved to get
Of course, the original momenta continue to be solutions of the equation as well.
When a particle collides with a wall, momentum is no longer conserved. Energy is, however, and the component of the velocity parallel to the wall remains unchanged. Therefore, the effect of a collision of a molecule with a wall is to reverse the sign of the velocity component perpendicular to the wall.
When a molecule collides with the end of a wall, energy and angular momentum about the end of the wall are conserved. Therefore
This results in the following equations for and :