For this case, the first thing we must do is define variables.
We have then:
x: number of days
y: total hours
The equation modeling the problem is given by:

Substituting for y = 21 hours we have:

From here, we clear the value of x:

It takes Gary 12 days to train 21 hours.
We know that Gary trains 3 days a week.
Therefore, the number of weeks is given by:

Answer:
it will take Gary 4 weeks to exercise a total of 21 hours