Final answer:
The amount of hay in the second barn is 30 tons, and the amount of hay in the first barn is 90 tons.
Step-by-step explanation:
To solve this problem, let's first represent the amounts of hay in the two barns. Let x be the amount of hay in the second barn. Then, the amount of hay in the first barn can be represented as 3x, since it is 3 times more than the second barn.
After 20 tons of hay were removed from the first barn, the amount remaining becomes 3x - 20. After 20 tons were added to the second barn, the amount becomes x + 20.
According to the problem, the amount of hay in the second barn, x + 20, is 5/7 of the amount remaining in the first barn, 3x - 20. Setting up this equation, we have:
x + 20 = (5/7)(3x - 20)
Now we can solve for x by simplifying the equation and solving for x:
x + 20 = (15/7)x - 100/7
Let's multiply both sides by 7 to eliminate the fraction:
7(x + 20) = 15x - 100
7x + 140 = 15x - 100
Subtracting 7x from both sides, we get:
140 = 8x - 100
Adding 100 to both sides, we obtain:
240 = 8x
Dividing both sides by 8, we find that:
x = 30
Therefore, the amount of hay in the second barn is 30 tons, and the amount of hay in the first barn is 3 times that amount, which is 90 tons.