Level 9: Crossroads

Task

Build a multiplexer (MUX): selects one of two input bits.

A multiplexer (MUX) is a 2-to-1 digital switch. Three inputs: A, B (data) and Sel (selector). Rule: Sel=0 → output=A; Sel=1 → output=B.

Solution

Formula: Q = (A AND NOT Sel) OR (B AND Sel).

How it works: when Sel=0, line A is "open" (A AND 1 = A), line B is "closed" (B AND 0 = 0). When Sel=1 — opposite.

Circuit: 1. Invert Sel with NOT — get ~Sel. 2. Feed A and ~Sel into first AND. 3. Feed B and Sel into second AND. 4. Combine both AND outputs with OR.

The OR result is Q. Check the truth table: toggle Sel and verify the output switches between A and B.