If there are 125 girls, and the ratio is boys to girls, then you can divide 125 by 5 to get the multiplication factor. This would be 25. Now you can multiply 25 by 4 to get how many boys were in the gym, which would be 100. To get back to your original ratio, you can divide 100/125 by 25 on top and bottom to get 4:5, or 4/5. :)
Equations of straight lines are in the form y = mx + c (m and c are numbers). m is the gradient of the line and c is the y-intercept (where the graph crosses the y-axis).