Circumference formula:
I took the length of the Equator, 40,075.016686, and divided it by the difference in degrees N between the North Pole and the Equator, 90. The answer was 445.277963. This is the base length. Thus, y=-445.277963x+40,075.016686. It's important to note that it uses degrees North. For instance, the Tropic of Capricorn is 23 degrees South, which is -23 degrees north.
Formula 1 (other side of Earth):
This one is fairly simple. The (y(|a-b|/180)) finds the latitudinal distance. What's actually happening is that you're taking the opposite of the longitude of the one place (if the latitude is 45 degrees East, you're using 45 degrees West) and using the circumference formula to find the distance from that point (which we'll call Point 1) to the second place, if they're at the same latitude. The |r1+r2| finds the distance from the first place to point 1, and then the Pythagorean Theorem is used to find the distance because the points make a right angle. I can make a diagram if you'd like.
Formula 2 (same side)
This one is the same as the other, but instead of using |r1+r2|, which find the distance by going over the North Pole, it uses |r1-r2|, which just finds the distance between the two degrees. Again, I can make a diagram if you want.