IMC 2020 · Problem 1

Day 127th IMC · Online

Statement

Let nn be a positive integer. Compute the number of words ww (finite sequences of letters) that satisfy all the following three properties:

(1) ww consists of nn letters, all of them are from the alphabet {a,b,c,d}\{\mathsf{a}, \mathsf{b}, \mathsf{c}, \mathsf{d}\};

(2) ww contains an even number of letters a\mathsf{a};

(3) ww contains an even number of letters b\mathsf{b}.

(For example, for n=2n = 2 there are 6 such words: aa\mathsf{aa}, bb\mathsf{bb}, cc\mathsf{cc}, dd\mathsf{dd}, cd\mathsf{cd} and dc\mathsf{dc}.)

Official solution

Hidden so you can work on the problem first.