# Puzzles/Arithmetical puzzles/Eggs to Market/Solution

He started with 7 eggs. How?

See Below:

At the market the farmer had 1 egg.

Working backward from toll gate two, the only way that could happen is by giving up half his eggs plus half an egg (dividing 3 into half to get 1.5 plus .5 to give up 2 eggs, leaving 1 egg).

Again working backward from toll gate one, the only way that could happen is by giving up half his eggs plus half an egg (dividing 7 into half to get 3.5 plus .5 to give up 4 eggs, leaving 3 eggs).

So, the farmer left the farm with 7 eggs!

(this proof is contributed by Pankaj Kumar)

Mathematical proof:

To calculate exact value of eggs, lets back-track;

At market, farmer has **1** egg.

Lets assume, farmer has **x ** eggs before passing Toll-Gate2 (before paying half eggs and an half egg)

Total eggs paid at Toll-Gate2 will be :

**gate2 = ( (x/2) + (1/2) )**

After passing, he is left with **1** egg .

Which gives,

( x - gate2 ) = 1

Replacing gate2

x - ( (x/2) + (1/2) ) = 1

x - ( (x+1) / 2 ) = 1

( 2x - x - 1 ) / 2 = 1

x - 1 = 2

x = 3

So, before passing Toll-Gate2 farmer has **3** eggs.

Now, assume before passing Toll-Gate1 farmer has **y** eggs ( at initial stage he as this many eggs)

Total eggs paid at Toll-Gate1 will be :

gate1 = ( (y/2) + (1/2) )

After passing, he is left with **3** egg .

Which gives,

( y - gate1 ) = 3

Replacing gate1

y - ( (y/2) + (1/2) ) = 3

y - ( (y+1) / 2 ) = 3

( 2y - y - 1 ) / 2 = 3

y - 1 = 6

y = 7

So, the farmer left the farm with **7** eggs!