DR.WANG Mathematics中文

2024 Euclid · Question 9

Counting & combinatorics · Counting by cases · number-theory · parity

Problem outline

A walk starts at 00 and takes nn steps, each +1+1 or −1-1, finishing at dd. Write cc for the number of changes of direction. (a) Count the walks with n=9,d=5n=9,d=5. (b) For n=9,d=3n=9,d=3, count those with even cc. (c) For how many attainable integer pairs (d,n)(d,n) with d≥0d\ge0 and 1≤n≤20241\le n\le2024 do exactly half of the walks have even cc?

Show answer and methods 1 methods

Answer

(a) 3636. (b) 4242. (c) 4343.

Method 1 Read the parity from the first and last steps

(a) If pp steps are positive and mm negative, then p+m=np+m=n and p−m=dp-m=d. Here p=7,m=2p=7,m=2. Choose the two negative positions in (92)=36\binom92=36 ways.

(b) Every direction change reverses the current sign, so an even number of changes means the two end signs agree. Here p=6,m=3p=6,m=3. With positive endpoints the middle seven slots contain three negatives, giving (73)=35\binom73=35. With negative endpoints they contain one negative, giving 77 more, for 4242.

(c) For n≥2n\ge2, a uniformly chosen ordering of the signs gives opposite endpoints with probability 2pm/[n(n−1)]2pm/[n(n-1)] by sampling two positions without replacement. Equal and opposite endpoints are equally likely exactly when 4pm=n(n−1)4pm=n(n-1). But 4pm=(p+m)2−(p−m)2=n2−d24pm=(p+m)^2-(p-m)^2=n^2-d^2, so the condition is d2=nd^2=n.

For n=1n=1 no walk changes direction and the condition fails. For every d=2,…,44d=2,\ldots,44, the number n=d2n=d^2 has the same parity as dd and is at least dd, so the endpoint is attainable. Since 452=202545^2=2025, exactly 44−2+1=4344-2+1=43 pairs qualify.

Source and attribution

The outline and worked methods on this page were prepared for DR.WANG Mathematics.

Original question (external)