In a dream, a genie explains that she cares for a certain number of ducks and dogs, and that if you can correctly tell her how many of each she has, she will grant your greatest wish. The genie also tells you that the total number of animals she cares for is , and these animals have feet total. (No, you can't use your wish to ask for more wishes. And nobody can get hurt.)
How many of each animal does the genie have?
Solution
If all animals were ducks, there would be feet. But there are . Each dog replacing a duck adds two feet to the total. Adding 40 feet means adding 20 dogs, leaving 10 ducks. Check:
Or, you can set up and solve a system of equations. Let be the number of ducks be and be the number of dogs.
Then, the equation counts the number of heads (in two ways), and the equation does the same for the number of feet. Solving the system gives and .