6. In a residential building, the ratio of man and woman is 5 to 8. In August, there are 30 men and 10 women moving out from the building. After that, the ratio of man and woman in this building is 1 to 2. How many men were there in the building before August 1?

please show work.

M/W=5/8

(M-30)/(W-10)=1/2

putting from the first equation M=5W/8
into the second equation

(5W/8-30)2=W-20

solve for W, then go back in the first equation and solve for M

To solve this problem, let's go step by step:

1. Let's assume there are "x" men and "y" women in the building initially.
2. According to the given information, the ratio of men to women in the building before August is 5:8. So, we can set up the equation 5/8 = x/y.
3. In August, 30 men and 10 women moved out. Therefore, the number of men remaining in the building will be (x - 30), and the number of women remaining will be (y - 10).
4. After the people moved out, the new ratio of men to women in the building is 1:2. So, we can set up the equation (x - 30)/(y - 10) = 1/2.
5. Now, we have two equations:
a) 5/8 = x/y
b) (x - 30)/(y - 10) = 1/2
6. We can solve these equations simultaneously to find the values of x and y.
Rearrange equation (a) to get: y = (8/5)x
Substitute this value of y into equation (b): (x - 30)/((8/5)x - 10) = 1/2
7. To simplify the equation, multiply both sides by 2*((8/5)x - 10):
2(x - 30) = ((8/5)x - 10)
2x - 60 = (8/5)x - 10
Multiplying through by 5 to clear the fraction:
10x - 300 = 8x - 50
8. Simplify and solve for x:
10x - 8x = 300 - 50
2x = 250
x = 125
9. Therefore, there were 125 men in the building before August 1.