Sunday, December 29, 2013

Puzzle 12

Fifty people, standing in a line, are to be assigned fifty tokens. Lets call them person 1, person 2....person 50 and token 1, token 2....token 50. A person will always be assigned a token with the same number as his number (except person 1), if that numbered token is not available, he will be assigned a random token. Person 1 is assigned a random token. You start assigning tokens from person 1 and go in sequential order. What is the probability that person 50 will be assigned token 50.
Example: For 4 people, P1->T2, P2->T1, P3->T3, P4->T4 is valid.  P1->T2, P2->T4, P3->T1, P4->T4 is invalid.

Friday, December 27, 2013

Arvind Kejriwal to be sworn in as Delhi CM today

And the day has arrived finally ....

One year old Aam Aadmi Party(AAP) leader Shri Arvind Kejriwal(AK) is to be sworn in as Chief Minister of Delhi today at Ramlila Maidan. 45-year old AK is the youngest CM of Delhi. More than 100,000 people are expected to attend this ceremony at Ramlila which is being held in public. AK is expected to take Delhi metro train from his house to the venue. Now that's a people's CM.

Just a few months back, other political parties had dismissed AAP saying they are not a true political party and wont be able to win more than 4-5 seats in Delhi. After winning 28 seats in Delhi and now forming the government, AK and his party has brought a political revolution in India.
 
It sure is a historic day in the politics of India. People in India are comparing this day to 15 Aug 1947, the day when India got independence. This is the beginning of a new political era in India.

AK has a lot of his responsibility on his shoulders in coming months and would be exciting to watch him in action. 

Saturday, November 2, 2013

Puzzle 11

A Japanese ship was en route in the open sea. The Japanese captain went for a shower removing his diamond ring and Rolex watch on the table. When he returned, his valuables were missing. Captain immediately called five suspected crew members and asked each one where and what he was doing for the last 15 minutes.
The Pilipino cook (in a heavy overcoat) : I was in fridge room getting meat for cooking.
The Indian Engineer (with a torch in hand) I was working on generator engine.
The Sri Lankan seaman: I was on the mast correcting the flag which was upside down by mistake.
The British Radio officer: I was messaging to company that we are reaching next port 72hrs. from now that is Wednesday morning at 1000hrs.
The British navigation officer: I am on night watch, so sleeping in my cabin.
The captain caught the liar. So who is the thief?

Some Financial Terms

When Issued (WI):

It is short for 'When, as and if Issued'.
A conditional transaction for a security which has been authorized for issuance but not issued. So it does not exist before the effective listing date. The trading for When Issued securities is done between the date the security is announced and the date when it is issued.  WI securities and bonds are bought and sold like any other security , the difference being they are settled only after the security is actually issued. The transactions may not be completed if the offerings are cancelled. When Issued markets can give an indication of level of interest potential investors have in the trading of the new issues. Orders When Issued are also called orders 'with ice' or orders 'when distributed'. For eg. government securities like US Treasuries, stock splits, new issues of stocks and bonds.

Monday, October 28, 2013

Puzzle 10

There is a theater which sells movie tickets for 0.5 $ . There are 12 people in the queue to buy tickets . 6 people have 0.5 $ change and rest have 1$ . For how many permutations can the theater manage the ticket distribution assuming they have no change during the start of the ticket distribution. (Generalise for 2n people where n people have 0.5$ change, n people have 1 $). (Hint: a very popular theorem in Math world)


Random days, I post a puzzle, math puzzle or mind puzzle or brainteaser or simply logic puzzle. If you have some good puzzles to share, please comment.  

Sunday, October 20, 2013

How to make Sabudana

Oil, Onion, Peanuts, Cumin Seeds, Potato
Turmeric, Salt, Chilli powder, little kitchen king masala, Tomato, Cilantro
 Green chillies, Ginger-Garlic paste
Lemon and ofc Sabudana

Saturday, October 19, 2013

Puzzle 9

In a village, there are n people with a mark on their forehead, but a person cant see his own mark, cant talk to other people, cant see in the mirror. Each day, people who are sure they have a mark leaves the village. After how many days, can it be determined there is no one left in the village with a mark.
On Day 1,atleast one person in the village has mark on his forehead.

Saturday, October 12, 2013

Puzzle 8

Two persons, A & B, perform a card trick with one deck of cards in front of audience in a room. B waits outside the room. A asks a member of the audience to shuffle the deck of cards, select five cards at random and pass them back to A. A looks at all the five cards and hands back one card to the audience member.  A arranges remaining four cards in some way and places them face down. B enters the room and looks at the four cards. Is it possible for B to determine the fifth card which is with the audience member. A & B are only allowed to communicate before the trick. (assume no jokers in the deck)

Sunday, October 6, 2013

Puzzle 7

Given a chess board with rooks in their starting positions, in how many ways can you place the two kings such that they are in safe positions.

Thursday, October 3, 2013

Puzzle 6

In a village, a lake was surrounded by 4 churches. When flowers are washed in the lake water, they double in number. One day, a person went there with some Lilies. He washed the lilies in lake water before entering each church. In each of the church she deposited the same number of flowers. By the time she was done with all four churches, she had no flower left with her. How many flowers did she deposit in each church? What is the least number of flowers she must have had initially?

Monday, September 30, 2013

Puzzle 5

You have a balance scale and you need to weigh some vegetables, the weight of vegetables can be any integer from 1 to 100. How many minimum number of weights you will need to guarantee you can measure the vegetables weight correctly . For eg, if the weight of vegetables is 13 or 15 and you have weights of value 2,3,4,6, you can weigh it correctly.

Sunday, September 29, 2013

Saturday, September 28, 2013

Puzzle 3

Find the next line in the series . 
6
1 6
1 1 1 6
3 1 1 6
1 3 2 1 1 6

Puzzle 2

There’s a street on which all houses are numbered sequentially (1,2,etc) except that a house number cannot be a multiple of 10. Each house owner wants to buy a new number plate (with same numbers as before), so they go to a store to buy number plates. The store has 100 of each numbers (eg 100 0's, 100 1's, etc.), if the house owners are catered sequentially, which will be the first house number for which a number plate won’t be available?

Sunday, September 22, 2013

Puzzle 1

Puzzle 1
There are 20 boxes, each box containing anywhere from 1 to 10 balls. No more than two boxes contain same no of balls. Each ball weighs 100gm. One of the boxes contains all defective ball/balls(each defective ball weigh 99 gm) You are given an electronic weighing machine. In how many minimum weighs can you determine which box has defective balls? 

Thursday, April 11, 2013

Markov Matrices


Markov Matrices  - Applications

Before going into the applications, let’s first discuss what is a Markov chain? 

 In simple terms, its a mathematical system with finite number of states where the system can be in only one of the possible states at any given time and the probability of the system being in a state at time period n depends only on its state at n-1 time period.  

Lets take an example: 
In a country, population of urban areas is 100 mm and that of rural areas is 200 mm. Every year, 10 % of the urban population moves to rural areas and 40 % of the rural population moves to urban areas. Now, the government of the country is interested in finding the population of rural and urban areas after 1 year, 10 years, and after too many years (tending to infinity), if the above percentages remain same and  everything else is constant.
We solve this problem with Markov matrix. It’s a very basic problem since there are only 2 states. One will appreciate power of Markov process when applied to problems with more than 2 states (for next time).
We put all the percentages (probability distribution) in a matrix as follows :

  A  =    U                 R

     U   (  0.90             0.40)
     R   (  0.10              0.60)
It means 90% of the urban population at time period T0 remains urban and rest 10 % moves to rural areas, same for second column. The above matrix A is called a Transition(Markov) matrix, one important property of Markov matrix is sum of values in a column is always 1, also all values in Markov matrix are >=0 as they are probabilities.
We know the initial distribution of population, at time period 0,  we put them in a vector :

 P0 = ( 100 )
          ( 200 )

Now, if we have to find  urban population after 1 year , it is simply (0.90)*100 + (0.40)*200 =  170.
And rural population will be (0.10)*100 + (0.60)*200 =130.

Or P1 =    
     (  0.90   0.40 )    ( 100 )     =    ( 170 )   
      ( 0.10   0.60 )    ( 200 )            ( 130 )

i.e. P1 = A*P0


Now, Population after 2 years,  P2 = A*P1  ….. as population in any given state depends only on its previous state.
So, P2 = A*P1 = A*(A*P0) = (A^2) *P0
Likewise, population after 10 years, P10 = (A^10) * P0
To make calculations simple, we decompose our matrix , we convert matrix A to UDU¯¹ where U is a matrix of which the columns correspond to Eigen vectors of A, D is a diagonal matrix with values on the diagonal as Eigen values of A.  

Another property of Markov Matrix : One of the eigen values of a Markov matrix is 1 (more on this and what are eigen values/eigen vectors for next time ).

For eigen value 1, we find corresponding eigen vector.

Here comes our famous eigen value – eigen vector equation,

  As=ƛs  …….. (1)

where ƛ is an eigen value of matrix A and s is the eigen vector corresponding to eigen value ƛ.  

If we substitute ƛ = 1 in above equation, one of the eigen vectors,
 s =  ( 4 )
        ( 1 )
  

Since, As=ƛs ....  As-ƛs=0  …….. (A-ƛI)s = 0 …… I is the identity matrix.

For the characteristic polynomial, determinant (A-ƛI) = 0 ……. Solving this characteristic polynomial we get the other eigen value as ½ .

Putting ƛ = ½ in our equation (1), we get eigen vector as  ( 1 )
                                                                                      ( -1 )

Thus,  A = UDU¯¹  = (  4   1 )    ( 1   0 )  ( 1/5    1/5 )
                                ( 1  -1 )    ( 0   ½ ) ( 1/5    -4/5 )

A^10 = U*(D^10)* U¯¹


Population after 10 years, P10 = (A^10) * S = U*(D^10)* U¯¹ * S

P10 =   (  4   1 )   ( 1   0       )     ( 1/5    1/5      100 )
            ( 1  -1 )   ( 0   ½^10 )     ( 1/5    -4/5     200 )

       =  ( 240 – 140/(2^10)   )
           ( 60  + 140/(2^10)   )

Population after too many(infinite) years, P(inf) = (A^inf) * S = U*(D^inf)* U¯¹ * S

P(inf) =     ( 4   1 )     ( 1   0 )          ( 1/5    1/5 )     (  100 )
                ( 1  -1 )    ( 0   0 )         ( 1/5    -4/5 )    (  200 )

Solving above, we get P(inf) =    ( 240 )
                                                  ( 60   )

This means, if the probability distribution and everything else remains same,after too many years, the population in urban areas would be 240 mm and that in rural areas would be 60 mm, which gives us a very significant insight into the population of the country which otherwise would not be known, and it could be a concern for urban areas in future. 
  
In the same way, we can solve following problem also,

Consider population of three countries , india(100), china(200), usa (600).
Every year, 10% of Indian population moves to usa, 5 % moves to china. 20% of china population moves to usa and 5% of its population moves to india. 5% of usa population moves to india and 5% to china.
Lets say the government of these countries is interested in finding population of their countries after few years if it keeps on happening like this, everything else remaining same .

We will discuss above problem and few more problems next time (sry for matrix notations , im still figuring out how to put matrix brackets on blogspot :|).

If any mistake in above calculations or anything unclear, leave a comment or shoot an email puneetgoenka24@gmail.com



Tuesday, April 9, 2013

An exciting weekend coming ......


Looking forward to an awesome weekend, lot of fun activities ..... first of all Google code jam is back after a yr and the 25 hours qualifying round is this weekend starting Friday evening (UTC 11pm) , ... corona+coding+music FTW....\m/\m/ ......

 then there is April month puzzle contest held by Riad Khanmagomedov from April 5 -13, for more info on how to participate : http://logicmastersindia.com/2013/04Contest/


TedxRutgers is back too after a yr and this time the theme is 'Road to Action' ,... this Sunday on Cook campus.

 also, WPF Sudoku Grand prix - Serbian Round next weekend ... 20-22 April.


Saturday, January 12, 2013

Its because of that one girl ......


It because of that one girl all these years you enjoyed watching romantic movies and romantic songs, which otherwise you dont. Its because of that one girl you feel there is someone special in your life, who thinks of you and you think of her every single day. Its because of that one girl..........

and then one day u hear dat one girl got married or committed or somthing, and now no one is special in your life, suddenly a huge void is there in your life now and you never knew if she really felt about u the way u felt .....