• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
  • CAT Online Coaching
  • CAT Coaching in Chennai
  • Bharath’s Reading List
  • CAT Preparation
    • How to Prepare for CAT Exam
      • How to Prepare for CAT Quantitative Aptitude
      • How to prepare for CAT DILR
      • How to prepare for CAT VARC
    • 2IIM’s CAT Questions
    • CAT Syllabus
    • CAT Previous Year Paper
    • What is CAT Exam all about?
  • 2IIM CAT Preparation Reviews

2IIM CAT Preparation Blog

The Best CAT Online Coaching

Best Online CAT Coaching

  • Email
  • Facebook
  • Instagram
  • LinkedIn
  • Phone
  • YouTube
You are here: Home / CAT DILR / Logical Reasoning For CAT / Teach For Fun: An LR Puzzle on ‘Bulls and Cows’

Teach For Fun: An LR Puzzle on ‘Bulls and Cows’11 min read

September 5, 2020 By Rajesh 11 min read

Teach For Fun: An LR Puzzle on 'Bulls and Cows'

‘Teach For Fun’ is a contest we at 2IIM announced as a run-up to the Teachers’ Day. Teaching and learning are two things that do not have finite limits (talking the language of Math, a subject that gives me immense joy). It is our strongest belief that new ideas, concepts and teaching methodologies, approaches and puzzles can come from anybody, irrespective of the “teacher” tag. When I took a look at all the entries submitted by our ever-enthusiastic students, it was thoroughly fascinating . It is always a good, refreshing sign when students chime in with Mathematical, logical puzzles and thoughtful views on education, in general.

Thank you, once again, for participating in the contest. Happy Teachers’ Day to everybody out there. All of us are teachers, one way or the other.

Here is a fabulous puzzle from Vishnu Sai that involves a bit of logical reasoning, some bits of Derangements, and some more of Permutations and Combinations. Happy solving!

Rajesh

Cracking the Code

The puzzle – Bulls and Cows

Ramesh and Suresh, while enjoying their five-star chocolate, decided to forget the world around them by playing a version of the game “Bulls and Cows”.  
The rules of the game are as follows: 

Ramesh forms a secret 4-digit code (without repetition and excluding 0) and Suresh must break the code using clues given by Ramesh. 

For every guess from Suresh, Ramesh tells the number of Bulls – the number of digits in his code and in correct position – and the number of Cows – the number of digits in his code and not in the correct position. 

Example

  1. If Ramesh’s number is 8352 and Suresh guesses 3459, Ramesh would reply 1 Bull (5 is in the code and in the right position) and 1 Cow ( 3 is in the code and not in the right position). 
  2. Ramesh’s code = 6724; Suresh’s Guess = 7429  

Ramesh’s reply in this case would be 1 Bull 2 Cows 

The questions: Codes, Guesses, Bulls and Cows

(Please note each question is independent and the information must not be taken forward to the following questions unless otherwise informed in the question) 

  1. What are the total number of possible codes that can be formed by Ramesh? 
  1. If Ramesh replies Suresh with 4 Bulls and 0 Cows, what is the total number of possible ordered pairs of Ramesh’s Code and Suresh’ guess? 
  1. What is the total number of possible ordered pairs of Ramesh’s Code and Suresh’x guess, if Ramesh replies Suresh with 2 Bulls and 2 Cows? 
  1. Assuming Ramesh replies Suresh with 3 Bulls and 1 Cows, what is the total number of possible ordered pairs of Ramesh’s Code and Suresh’s guess?  
  1. What is the total number of possible ordered pairs of Ramesh’s Code and Suresh’s guess, if Ramesh replies Suresh with 0 Bulls and 4 Cows? 
  1. If Ramesh replies Suresh with 0 Bulls and 0 Cows, what is the total number of possible ordered pairs of Ramesh’s Code and Suresh’s guess 
  1. What is the total number of valid reply pairs of Bulls and Cows possible? 

The answers

Please do not read further until and unless you have tried solving the questions on your own.

  1. 9P4 or 3024 
  1. 9P4 or 3024 
  1. 18144  
  1. 0 
  1. 27216 
  1. 9P4 x 5P4 = 9! = 362880 
  1. 14 

The explanation

Question #1

We must find the total number of possible codes that can be made by Ramesh. 

This question is analogous to the famous P&C question asked: “How many 4 digit numbers can be formed without any repetition and without using 0?”

  • Total number of ways of choosing first digit = 9 
  • Total number of ways of choosing Second digit = 8 (we can’t use the digit used up for the first digit) 
  • Similarly, number of ways of choosing third and fourth digits are 7 and 6, respectively. 

So, the total number of ways is obtained by 9*8*7*6 = 9P4 = 3024

Question #2

Total number of ordered pairs of Ramesh’s code and Suresh’s guess with 4 Bulls and 0 Cows

Let us say Ramesh’s code is 1234 and for Suresh’s guess to obtain 4 Bulls, Suresh must also guess 1234.  

Therefore, to obtain 4 Bulls, Suresh must exactly guess the same number formed by Ramesh. 

Hence, the answer for this question would also be the total number of codes that are possible to be made = 9P4 =3024 

Question #3

Total number of ordered pairs of Ramesh’s code and Suresh’s guess with 2 Bulls and 2 Cows 

We must use a concept of Derangements here.  

(Denote the function D(x) to return the number of derangements of x.  The same notation will be used in the following solutions) 

Observe that Suresh’s guess must contain these 4 digits only and no other digit.  Hence, we don’t require to select digits from the other 5 digits as the response from Ramesh is 2 Bulls and 2 Cows.  

Therefore, 4 Common digits from 9 digits can be selected in 9C4 ways.

First number in the pair can be arranged in 4! Ways

Therefore, first number can be formed in 9C4 * 4! Or 9P4 

Suresh’s guess or second number in the pair 

2 out of these 4 digits are in right place and the other 2 are not in right place. 

Number of ways of selecting 2 digits from 4 digits to be fixed = 4C2 

Number of ways of other 2 digits not in the right place = Number of derangements of 2 = D (2) =1 

Solution

(Number of possibilities of selecting first number in the pair) *(No. of possibilities of selecting the second number in the pair with the condition) 

Number of ways of selecting first number = 9P4 

No. of ways of forming second number in the pair with the condition = 4C2 * D(2) = 6*1  

Final Solution = (9P4) * (4C2 *D(2) )  = 3024 *6 = 18144 

Question #4

Total number of ordered pairs of Ramesh’s code and Suresh’s guess with 3 Bulls and 1 Cows 

Let us try to solve this question in 2 ways. 

Simple Analysis of the given condition involving Bulls and Cows

From the condition, we understand that all 4 digits from Suresh’s guess exist in Ramesh’s code. And, 3 of these are in the right place and 1 digit is in the wrong place.

Can this situation ever occur?

When the 3 digits are fixed in their right place, 4th digit if not in its right place , cannot displace another digit from its right place too. 
Suresh must tell the code maker Ramesh to check his response and not be too distracted by the taste of his chocolate (some fun from the old five star chocolate commercials😊) 

Final Solution: Zero

Mathematical Solution 

Reusing the same analysis from the previous question,  

Ways of forming Suresh’s guess = 4c3 * D(1)  

We know that D(1) =0. 

Therefore, final solution = 0 

Question #5

Total number of ordered pairs of Ramesh’s code and Suresh’s guess with 0 Bulls and 4 Cows 

Again, reusing most of the analysis from the previous questions:

Ramesh’ Code or first number in the pair can be formed in 9P4 ways 

Suresh’s guess 

Suresh’s guess must have all the 4 digits and no digit must be in right place. 

This is the same as finding Derangements of 4 = D(4) = 9 

Solution = (Number of possibilities of selecting first number in the pair) *( No. of possibilities of selecting the second number in the pair with the condition) 

= (9P4) * (D(4))  = 3024 * 9 = 27216 

Question #6

Total number of ordered pairs of Ramesh’s code and Suresh’s guess with 0 Bulls and 0 Cows 

Number of ways of forming Ramesh’s code or First number in the pair = 9C4*4! Or 9P4 = 3024 

Number of ways of forming Suresh’s guess 

Suresh’s guess must contain no digit from Ramesh’s code and must have been formed from the 5 other digits not in Ramesh’s code.

Therefore, total number of ways Suresh could have formed his code = 5C4 * 4! = 5P4  

Solution= Total possibilities of Ramesh’s code X Total possibilities of Suresh’s guess 

= 9P4 * 5P4 = 9! 

= 362880 

Question #7

Total number of possible valid pairs of Bulls and Cows possible 

Does this question resemble a question as follows? 

Number of ordered pairs (b,c) such that b and c non – negative integers and satisfying  b+c < =4? (b for number of bulls and c for number of cows) 

Let us solve b+c < =4 

Introduce dummy variable d such that b+c+d = 4 (b, c,d >=0) 

Number of solutions = (n+r-1)C(r-1) = (4+3-1) C(3-1) = 6C2 =15  

Are we getting the right number of combinations of Bulls and Cows, though?

NO. Caution here!!!! 

Remember the case – Bulls = 3 Cows = 1? We did find out it is not possible. 

We must not count this case. 

So, let us just count all 15 possible cases and remove invalid pairs.

Case B+C =4 

(4,0) 

(0,4) 

(1,3) 

(3,1) – Not Valid 

(2,2) 

Case B+C =3 

(1,2) 

(2,1) 

(3,0) 

(0,3) 

Case B+C =2 

(2,0) 

(0,2) 

(1,1) 

Case B+C=1 

(1,0) 

(0,1) 

Case B+C = 0 

(0,0) 

Total valid pairs = 4+4+3+2+1 = 14 

So, indeed, we could have subtracted the invalid (3,1) from 15 cases earlier but as the number is quite low, we could do this counting in order to be completely sure.

Hope you had fun solving this puzzle 🙂 Cheers!

Vishnu Sai has been working as a software developer in Bengaluru for a year now. He finds interest in learning and exploring new fields in Mathematics. He loves to solve logical puzzles and games. Vishnu is preparing for the CAT examination this year and  wishes all aspirants good luck for CAT 2020! He can be reached at vishnusai.g@gmail.com.

Share this:

  • Twitter
  • Facebook
  • WhatsApp

Reader Interactions

Leave a Reply Cancel reply

Primary Sidebar

Recent Posts

  • Reading List | This Week | March 4th week 2023
  • Can a Weak Student Crack CAT Exam?
  • Reading List | This Week | March 3rd week 2023
  • Reading List | This Week | March 3rd week 2023
  • What should you look for in Online CAT Coaching?

Categories

  • Announcements (40)
  • B-School Selection Process (10)
  • CAT 2020 (33)
  • CAT 2021 (82)
  • CAT 2022 (21)
  • CAT Coaching (2)
  • CAT DILR (20)
    • Data Interpretation For CAT (5)
    • Logical Reasoning For CAT (7)
  • CAT Gyan (103)
  • CAT Live Sessions (2)
    • CAT Meetup (1)
  • CAT Preparation Strategy (193)
    • Achievers talk (6)
    • Announcements (29)
  • CAT Quantitative Aptitude (30)
  • CAT Reading List (177)
    • Economy Business (1)
    • Fiction Others (1)
    • Humans Culture (2)
    • Politics Law Crime (2)
    • Psychology & Philosophy (2)
    • Reading List – This Week (166)
    • Technology Industry Science (2)
  • CAT Verbal Ability (20)
    • CAT Reading Comprehension (11)
  • CAT WAT GDPI (18)
  • GMAT (2)
  • IIFT 2022-2024 (1)
  • IPMAT (3)
  • MAH-CET Preparation (1)
  • mba (37)
    • rural management (1)
  • MICAT (1)
  • Mock CATs (5)
  • NMAT (3)
  • PGDBA Examination (2)
  • SNAP 2021 (1)
  • Top B-schools (5)
  • Uncategorized (14)
  • XAT 2021 (4)
  • XAT 2022 (2)
  • XAT Preparation (10)
    • Announcements (3)

Archives

  • March 2023 (8)
  • February 2023 (8)
  • January 2023 (5)
  • December 2022 (2)
  • November 2022 (5)
  • October 2022 (3)
  • September 2022 (10)
  • August 2022 (9)
  • July 2022 (18)
  • June 2022 (22)
  • May 2022 (17)
  • April 2022 (9)
  • March 2022 (4)
  • February 2022 (6)
  • January 2022 (4)
  • December 2021 (1)
  • November 2021 (4)
  • October 2021 (12)
  • September 2021 (14)
  • August 2021 (32)
  • July 2021 (31)
  • June 2021 (22)
  • May 2021 (9)
  • April 2021 (5)
  • March 2021 (14)
  • February 2021 (15)
  • January 2021 (21)
  • December 2020 (19)
  • November 2020 (8)
  • October 2020 (14)
  • September 2020 (33)
  • August 2020 (31)
  • July 2020 (31)
  • June 2020 (12)
  • May 2020 (9)
  • April 2020 (8)
  • March 2020 (12)
  • February 2020 (10)
  • January 2020 (14)
  • December 2019 (5)
  • November 2019 (5)
  • October 2019 (7)
  • September 2019 (11)
  • August 2019 (6)
  • June 2017 (1)
  • October 2015 (1)
  • August 2015 (1)
  • January 2011 (1)

Follow Us!

  • Email
  • Facebook
  • Instagram
  • LinkedIn
  • Phone
  • YouTube

Footer

The heights by great men reached and kept were not attained by sudden flight,
but they, while their companions slept,
were toiling upward in the night.

- Henry Wadsworth Longfellow

Copyright © 2019. All rights reserved by 2iim.com - A Fermat Education initiative. Privacy policy | Terms & Conditions