089Mathematics · Statistics

Mean and median with repeated unknowns

Mean and median with repeated unknowns

Mean and median with repeated unknowns · x₁,y₁,x₂,y₂,…,count

  • 196 bytes
  • COMP mode
01

Worked examples

Example 1

Eight seedlings in a school garden have heights, in cm, of 2, 3, 6, 6, x, x, x and y, where x and y are positive integers (three seedlings share the height x). The mean and the median of the heights are both 6 cm. Find every possible pair (x, y), and state which pair gives the largest range.

Answer
(6,13), (9,4), (10,1) — 3 pairs; largest range 11 cm with (6,13).
Standard solution (without a calculator)
  1. Use the mean: 2+3+6+6+3x+y=8(6), so 3x+y=31 and y=31−3x>0, giving x=1, 2, …, 10.
  2. Rule out small x: if x≤5, the five values 2, 3, x, x, x are all below 6, so the 4th and 5th ordered values are below 6 and the median cannot be 6.
  3. Check the remaining candidates: (6,13) sorts to 2,3,6,6,6,6,6,13; (9,4) to 2,3,4,6,6,9,9,9; (10,1) to 1,2,3,6,6,10,10,10 — each has 4th and 5th values 6. (7,10) and (8,7) give median 6.5.
  4. Compare ranges: 13−2=11, 9−2=7 and 10−1=9, so (6,13) gives the largest range.
Do it on the calculator

Example 2

Over eight days a library records how many books are returned late each day: 10, 9, 5, 5, x, x, x and y, where x and y are positive integers. The mean and the median of the eight numbers are both 5. Find every possible pair (x, y) and explain why x=3 does not work.

Answer
(1,8), (2,5) — 2 pairs; x=3 gives median 4.
Standard solution (without a calculator)
  1. Use the mean: 10+9+5+5+3x+y=8(5), so 3x+y=11 and y=11−3x>0, giving x=1, 2 or 3.
  2. List the candidates: x=1, 2, 3 give y=8, 5, 2 respectively.
  3. Check the median: (1,8) sorts to 1,1,1,5,5,8,9,10 and (2,5) to 2,2,2,5,5,5,9,10; both have 4th and 5th values 5. (3,2) sorts to 2,3,3,3,5,5,9,10, whose median is (3+5)/2=4.
  4. State the answer: (1,8) and (2,5); the final count is 2.
Do it on the calculator

Example 3

A player's scores in eight rounds of a game are 5, 13, 6, 6, x, x, x and y, where x and y are positive integers. Can the mean and the median of the eight scores both be 6? Give a complete reason.

Answer
No — no pair works; count 0.
Standard solution (without a calculator)
  1. Use the mean: 5+13+6+6+3x+y=8(6), so 3x+y=18 and y=18−3x>0, giving x=1, 2, 3, 4 or 5.
  2. List the candidates: (1,15), (2,12), (3,9), (4,6), (5,3).
  3. Check the ordered middle: for x≤4 the 4th and 5th values are 5 and 6, so the median is 5.5; (5,3) sorts to 3,5,5,5,5,6,6,13 with median 5. None gives 6.
  4. Conclude: no pair satisfies both conditions, so the answer is no; the count is 0.
Do it on the calculator
02

When to use it

The eight-value list is a,b,c,c,x,x,x,y: c occurs twice and x three times. Mean c gives 3x+y=6c−a−b; the median condition requires the two central ordered positions to average c. The program tests positive integer x and y and displays valid pairs.

Enter the fixed values

  • Enter A=a, B=b and C=c in that order. All three must be integers from 1 to 200 inclusive. The unknowns x and y are positive integers; they are not entered.

Read pairs and count

  • Each solution is shown as X=x followed by Y=y, with x increasing. Press EXE after each displayed value to continue; the final D is the number of pairs, not another x or y. If none qualify, only 0 is shown.

Question types

  • Use this as original HKDSE Mathematics Compulsory Part statistics practice involving mean, median and repeated observations. Write the mean equation and verify the ordered median in the written solution.

Before you start

  • The model is exactly a,b,c,c,x,x,x,y, with mean and median both c. It does not solve a different number of observations or different repetition counts.
  • A, B and C must each be an integer in [1,200]. An invalid fixed input produces −1; this is an error marker, not a solution count.
  • The candidate x and y must be positive integers. A final 0 means no pair satisfies both conditions; it differs from the invalid-input marker −1.
  • The program scans candidates in increasing x, displaying x then y for each match. The last screen counts pairs; copy each pair before advancing.
  • The integer check switches from Fix 0 to Norm 1 before displaying solutions. Avoid extremely large intermediate values or precision loss near the calculator’s limits.
  • Blank EXE at an input prompt may reuse an earlier stored value. Enter the intended integer explicitly. P1 occupies 196 bytes of P1–P4’s 680-byte COMP space and overwrites A, B, C, D, M, X, Y.

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.

Checking access…

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.