Monday, September 17, 2007

Primary 5 Maths Question

During 1 week September school holiday, my son (Primary 5) was given a set of maths questions (50 of them) to solve. One of them seems almost clueless but later found out that there is a better way to solve it than a brute force approach.

I am not sure how many of our 11-year old kids can solve this type of question? Or, how many of the teachers can solve this question and manage to explain to the kid until they understand ? Anyway, the question is:

[Q] John bought 3 of the 6 items and Peter bought 2 of the remaining items. John spent twice as much as Peter. Which items did each of them buy ?

Item 1Ping-pong bat$4.70
Item 2Ping-pong ball$2.70
Item 3Shuttlecock$1.40
Item 4T-shirt$3.10
Item 5Shoes$7.20
Item 6Racket$6.10

Let me take you through my thinking process.

  • My first impression is that how on earth can I find a solution using the "model approach" (method to solve a problem without using algebra, it is taught in primary school). I did not spend much time in thinking of the problem because there are 60 combinations to try ( 6C3 * 3C2 ) and it would be too tough to do it manually. Instead, I tapped onto my programming skill to do a "brute force attack" approach to verify an answer(s) exist. This is the Tcl script I wrote:
    package require struct
    array set price { 1 4.70 2 2.70 3 1.40 4 3.10 5 7.20 6 6.10 }
    proc PriceSum { items } {
     global price
     set peterSum 0
     foreach i $items {
      set peterSum [expr {$peterSum+$price($i)}]
     }
     return $peterSum
    }
    set all [array names price]
    set allN [array size price]
    for { set i 1 } { $i<=$allN } { incr i } {
     for { set j $i } { $j<=$allN } { incr j } {
      for { set k $j } { $k<=$allN } { incr k } {
       if { $i == $j || $j == $k || $i == $k } { continue }
       set john     [list $i $j $k]
       set peter012 [struct::set difference $all $john]
       set peter01  [list [lindex $peter012 0] [lindex $peter012 1]]
       set peter12  [list [lindex $peter012 1] [lindex $peter012 2]]
       set peter02  [list [lindex $peter012 0] [lindex $peter012 2]]
       set peterSum01  [PriceSum $peter01]
       set peterSum12  [PriceSum $peter12]
       set peterSum02  [PriceSum $peter02]
       set johnSumHalf [expr [PriceSum $john]/2]
       if { $johnSumHalf == $peterSum01 } {
        puts "John: $john, Peter: $peter01"
       } elseif { $johnSumHalf == $peterSum12 } {
        puts "John: $john, Peter: $peter12"
       } elseif { $johnSumHalf == $peterSum02 } {
        puts "John: $john, Peter: $peter02"
       }
      }
     }
    }
    
    The answer is:
    John: 1 4 5, Peter: 6 3

    OK, a unique solution does exist. If it is a Primary 5 question, I am sure there is a simplier way to solve it.

  • If John bought 3 items and Peter bought 2 items, there will be 1 item left. Ok, may be we can work out the total amount spent by John and Peter and see whether the amount can be divisble by 3, since John spent twice than Peter. Hey, that's the model approach (see model below), isn't it. Great, let's tabulate the result

    Model:

    John spent
     
     
    Peter spent
     

    Item NTotal w/o Item NDivisble by 3?
    1$20.50No
    2$22.50Yes
    3$23.80No
    4$22.10No
    5$18.00Yes
    6$19.10No

    Now we narrowed down to two possible routes, either item 2 or item 5 is not being bought by John and Peter.

    • Case 1: Item 2 not being bought
      If John spent twice the amount as Peter, the 10¢ digit of the sum of 3 items has to be an even number (we do not have to work out the exact total). We can ignore it if it is odd.
      John's Items10¢ digit
      (sum of John's items)
      Peter's Items10¢ digit
      (sum of Peter's items)
      Twice ?
      1,3,425,63No
      1,3,5
      1,3,624,53No
      1,4,503,65Yes
      1,4,6
      3,4,5
      3,4,661,59No
      4,5,641,31No
      Bingo! John bought Items 1,4,5 and Peter bought items 3 and 6. This tally with my "brute force attack" approach.
    • Case 2: Item 5 not being bought
      You can repeat the same tabulation but I can tell you that there is no solution.

  • Another approach that I can think of. If you look at the cost of the items, the 10¢ digits are basically just 1, 2, 4 and 7. There are only 4 numbers and there won't be a lot of combination to try. If John spent twice as much as Peter, the 10¢ digit sum has to be even, let's tabulate so that we can narrow down our search
    John's items
    (10¢ digit)
    Cost of 3 items
    (10¢ digit)
    Possible Answer?
    1,2,47No
    1,2,70Yes (ie, items 5,[12],[4,6])
    1,4,72Yes (ie, items 3,[12],[4,6])
    2,4,73No
    Note: [12] means either 1 or 2, in regular expression notation

    Another tablulation for John's items

    John's itemsSum of 2 items = half of John's (10¢ digit)John=2xPeter?
    5,1,4 ($15.0)$7.50 = items 3,6Yes
    5,1,6 ($18.0)$9.00 = xx
    5,2,4 ($12.0)$6.00 = xx
    5,2,6 ($16.0)$8.00 = xx
    3,1,4 ($9.20)$4.60 = xx
    3,1,6 ($12.2)$6.10 = xx
    3,2,4 ($7.20)$3.60 = xx
    3,2,6 ($10.2)$5.10 = xx

Hope that the teacher and the students read my blog:-)

Labels: ,

0 Comments:

Post a Comment

<< Home