Mary baked a number of cookies. She ate one, gave half of the remaining cookies to her sister, ate another one, then gave half of the remaining cookies to her brother. Given that she ended up with 5 cookies, how many did she start with?

1 Answer
May 30, 2016

23

Explanation:

Work backwards through the story:

  • Mary ends up with 5 cookies, after giving away half to her brother. So before she gave away half, she had 10 cookies.

  • Before she had 10 cookies she ate one, so prior to eating that cookie she had 11 cookies.

  • Before she gave away half to her sister, she had 22 cookies.

  • Before eating the first cookie she started with 23 cookies.

We can express the story algebraically.

If Mary starts with n cookies, then she ends up with:

((n-1)/2-1)/2 = 5

Multiplying both sides by 2 we get:

(n-1)/2-1 = 10

Add one to both sides to get:

(n-1)/2 = 11

Multiply both sides by 2 to get:

n-1 = 22

Add one to both sides to get:

n=23

Alternative method

In terms of functions, we can define:

d(x) = x-1

h(x) = x/2

Then the inverse functions are:

d^(-1)(x) = x+1

h^(-1)(x) = 2x

If n is the original number of cookies then:

h(d(h(d(n)))) = 5

Hence:

n = d^(-1)(h^(-1)(d^(-1)(h^(-1)(5)))) = 2*(2*5+1)+1 = 23