---
title: "Which 2x2 Hill keys can be reversed? A determinant checklist"
url: https://memory.wiki/Lksw_Poe
updated: 2026-10-24T17:46:52.269Z
source: "memory.wiki"
---
# Which 2x2 Hill keys can be reversed? A determinant checklist

Before encrypting anything with a Hill cipher, check that the key can be undone. A message encrypted with a bad matrix cannot be decrypted uniquely, which is a frustrating way to learn the rule. The test takes ten seconds.

## The rule

Compute the determinant ad - bc of the matrix, reduce it modulo 26, and find the greatest common divisor with 26. The key is usable only when that divisor is 1. Since 26 = 2 * 13, the determinant must be odd and must not be a multiple of 13. The usable determinant values are 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25, twelve in all.

## Five keys to check

- Rows [2, 4] and [1, 2]: determinant 0, gcd with 26 is 26, **not usable**
- Rows [4, 2] and [2, 3]: determinant 8, gcd with 26 is 2, **not usable**
- Rows [3, 5] and [1, 4]: determinant 7, gcd with 26 is 1, **usable**
- Rows [1, 2] and [3, 8]: determinant 2, gcd with 26 is 2, **not usable**
- Rows [6, 5] and [7, 5]: determinant 21, gcd with 26 is 1, **usable**

Try the first key by hand. Its determinant is 2*2 - 4*1 = 0, which shares every factor with 26. Information is lost: the pairs (2, 0) and (0, 1) both encrypt to (4, 2), so a decoder could never tell which one you sent.

When you want to test a matrix and see the result for a message, the [Hill cipher encoder and decoder](https://caesarcipher.org/ciphers/hill) validates the matrix as you type, which is useful for confirming your hand check.

## Common mistakes

- **Checking the determinant without reducing it.** A determinant of -5 becomes 21 mod 26, which is usable.
- **Assuming a large determinant is better.** Only its factors with 26 matter.
- **Testing only for zero.** The key 4, 2, 2, 3 has determinant 8, not zero, yet it is still unusable because 8 is even.
- **Using a key whose rows are multiples of each other.** That yields determinant 0.

The [home page](https://caesarcipher.org/) has other tools to continue with.

Published by the caesarcipher.org team; drafted with AI assistance.


---

## Summary
A 2x2 Hill cipher key is reversible only if the greatest common divisor of its determinant and 26 is 1. This requires the determinant to be odd and not a multiple of 13.

## Themes
- Hill cipher mathematics
- Matrix invertibility criteria
- Modular arithmetic applications

## Key takeaways
- A 2x2 Hill cipher key is usable if and only if the greatest common divisor of its determinant and 26 is 1.
- Usable determinants mod 26 must be odd and not a multiple of 13.
- Determinants must be reduced modulo 26 before checking for usability.
- Keys with rows that are multiples of each other result in a determinant of 0 and are always unusable.

## Insights
- A non-zero determinant does not guarantee a usable Hill cipher key because the determinant must specifically be coprime to the modulus 26.
- The common practice of only checking for a zero determinant is insufficient for ensuring unique decryption in a 2x2 Hill cipher.

## Open questions / gaps
- How does the invertibility criteria change when using a modulus other than 26?

