Problema Solution
Yoy decide to go on a shopping spree. After going in 5 different stores, you spent all your money. In each storenyou visited, you spent $1 more than half of what you had when you entered. How much money did you have when you entered the first store?
Answer provided by our tutors
let
x be the money i have when entering the first store
the money i have spent is
before going shopping i have 0 spent and $x left
first store: (x/2 + 1) spent and x - (x/2 + 1) = x/2 - 1 left
second store: (x/2 - 1)/2 + 1 = x/4 - 1/2 + 1 = x/4 + 1/2 spent and x/2 - 1- (x/4 + 1/2) = x/4 - 3/2 left
third store: (x/4 - 3/2)/2 + 1 = x/8 - 3/4 + 1 = x/8 + 1/4 spent and x/4 - 3/2 - (x/8 + 1/4) = x/8 - 7/4 left
forth store: (x/8 - 7/4)/2 + 1 = x/16 + 1/8 spent and x/8 - 7/4 - (x/16 + 1/8) = x/16 - 15/8 left
fifth store: (x/16 - 15/8)/2 + 1 = x/32 + 1/16 and x/16 - 15/8 - x/32 - 1/16 = x/32 - 31/16 left
since after the fifth store there is no money left we have
x/32 - 31/16 = 0
x = (31/16)*32
x = 62
indeed
if i had 62 before shopping
I store: 32 spent 30 left
II store: 16 spent 14 left
III store: 8 spent 6 left
IV store: 4 spent 2 left
V store: 2 spent and none left
Indeed, when i entered the first store i had $62.
Another way to solve this problem is by defining a function f(t) where t is the ordered number of the shop such that
f(0) = x
f(1) = f(0) - (f(0)/2 + 1) = f(0)/2 - 1
f(t + 1) = f(t) - (f(t)/2 + 1) = f(t)/2 - 1
f(t + 1) = f(t)/2 - 1
has a general solution
f(t) = x/(2^t) - (2^t - 1)/ (2^(t-1)
this can be proven by using Mathematical Induction.
in other words the function f(t) is defined as the money left after leaving the t store
that why after leaving the 5th store f(5) = 0
x/2^5 - (2^5 - 1)/ 2^4 = 0
x/32 - 31/16 = 0
x = 31*32/16
x = 62