The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

How Many Mice, Cats, and Dogs?

Date: 01/13/2003 at 15:32:47
From: Dale
Subject: How to express a problem as a formula

You are given $100 to buy pets. You must spend all of the money and 
you must buy 100 pets. You must choose at least one of each pet. The 
pets and their prices are: mice @ $0.25 each, cats @ $1.00 each, and 
dogs @ $15.00 each. How many mice, cats, and dogs must you buy?

I do not know how to express this in a formula, but I can work it out 
through trial and error.

56 * $.25 = $14
3 * $15 = $45
41 * $1 = $41

56 + 3 + 41 = 100
$14 + $45 + $41 = $100

Date: 01/14/2003 at 00:40:38
From: Doctor Greenie
Subject: Re: How to express a problem as a formula

Hello, Dale -

Your problem is one involving diophantine equations - sets of 
equations in which you have more unknowns than equations, but the 
possible solutions are limited (often, as in this case, to a single 
solution) by the fact that the values of the unknowns are integers.

You can learn more about the general method for solving problems like 
this by searching the Dr. Math archives using the 


Here in particular are links to two pages where you can find detailed 
discussions of a problem similar to yours:

   Buying Cows, Pigs, and Chickens 

   Farmer Buying Livestock 

The numbers in your problem lend themselves very nicely to 
understanding the general method for solving this type of problem, so 
let's look at the solution in your case.

We start with

  m = number of mice
  c = number of cats
  d = number of dogs

Then the total number of animals is 100:

  m+c+d = 100

And the total cost is $100:

  (m/4)+c+15d = 100

We have used all the given information, but we still have three 
unknowns and only two equations. We subtract these two equations to 

  14d - (3/4)m = 0

  14d = (3/4)m

  56d = 3m

Now we use the fact that d and m are both integers...

  m = (56/3)d

The fraction 56/3 is not an integer; for m to be an integer, d must 
be a multiple of 3.

Trying d=0 is not allowed, because the problem requires that you 
choose at least one of each type of pet.  Trying d=3 gives us m=56, 
which leads to c=41, which is the answer you found. Trying d=6 gives 
m=112, which is impossible because the total number of animals is 
100. So the answer you found is the only one.

I hope this helps.  Please write back if you have any further 
questions about any of this.

- Doctor Greenie, The Math Forum 
Associated Topics:
High School Basic Algebra
High School Linear Equations
High School Number Theory
Middle School Algebra
Middle School Equations
Middle School Word Problems

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.