## On the Subject of Quaternions

“Quaternions came from Hamilton after his really good work had been done; and, though beautifully ingenious, have been an unmixed evil to those who have touched them in any way, including Clerk Maxwell.”
—William Thomson, Lord Kelvin

To disarm this module, compute the product of two quaternions as described below, and enter the correct component of the result on the keypad.

### Step 1: Computing the Quaternions

• The ten numbered keys on the keypad come in five colors: red, green, blue, yellow, and white. There are two of each color, ignoring the SUBMIT and CLR/NEG buttons.
• Along the right side of the module is the mathematical expression i2 = j2 = k2 = ijk = -1. This expression indicates which color maps to which component of the quaternion. (White does not map to a component.)
• Construct two quaternions q1 and q2 as follows:
• Assign the values on eight non-white keys to the components of the two quaternions, treating 0 as 10. q1 receives the number with the greater value for each component, unless the exception in Table A applies for that corresponding color, in which case q2 receives the larger number.
• If any digit in the serial number (again, treat 0 as 10) is a component of either quaternion, multiply that quaternion’s corresponding component by -1. (Even if the same digit appears multiple times in the serial number, only negate once.)
• If there are no lit indicators, replace q1 with its conjugate.
• If there are no unlit indicators, replace q2 with its conjugate.
• If the number of batteries on the bomb is odd, compute the product q1q2. Otherwise, compute q2q1. This product will be used in step 2.

### Table A: Exception Rules

Color Exception Rule
Red This color belongs to the i or j component.
Green The bomb has at least one PS/2 port.
Blue The bomb’s serial number contains a letter in the word BLUE.
Yellow The sum of the two white keys (this time treating 0 as 0) is prime.

### Step 2: Submitting the Answer

• Note the color of the SUBMIT button. This indicates which component of the product computed in step 1 must be entered to disarm the module. However, if the button is white, enter the square of its norm instead.
• Use the keypad to enter a number, and press SUBMIT to submit it.
• Press CLR/NEG to clear the display. This button’s color is irrelevant.
• To enter a negative value, press CLR/NEG when the display is blank to enter a negative sign, then enter the rest of the number.

### Appendix: A Brief Introduction to Quaternions

Quaternions are an extension of the complex numbers. A quaternion is usually expressed in the form a + bi + cj + dk, where a, b, c, and d are real numbers, and i, j, and k are the fundamental quaternion units, each being a square root of -1.

Quaternions can be added componentwise as follows:

(a1 + b1i + c1j + d1k) + (a2 + b2i + c2j + d2k) = (a1 + a2) + (b1 + b2)i + (c1 + c2)j + (d1 + d2)k

Quaternions also allow for scalar multiplication. For any real value m:

m(a + bi + cj + dk) = ma + (mb)i + (mc)j + (md)k

Multiplication is a bit tricker, as multiplication under quaternions is not commutative; that is, q1q2 does not necessarily equal q2q1. Multiplication of fundamental quaternion units works as follows:

i2 = j2 = k2 = -1  ij = k  jk = i  ki = j  ji = -k  kj = -i  ik = -j

The product of two quaternions (a1 + b1i + c1j + d1k)(a2 + b2i + c2j + d2k) can then be computed by expanding this expression using the distributive property, multiplying units, and combining like terms. More explicitly, the product is:

(a1a2 - b1b2 - c1c2 - d1d2)
+ (a1b2 + b1a2 + c1d2 - d1c2)i
+ (a1c2 - b1d2 + c1a2 + d1b2)j
+ (a1d2 + b1c2 - c1b2 + d1a2)k

The conjugate of a quaternion q = a + bi + cj + dk, denoted q*, is a - bi - cj - dk.

The norm of a quaternion q = a + bi + cj + dk, denoted |q|, is sqrt(a2 + b2 + c2 + d2). Norms satisfy the relation |q1|·|q2| = |q1q2| for any two quaternions q1, q2.