Cracking the Code: Binary Basics

The Towers of Hanoi

A set of colorful, cascading disks stacked on a peg. What could easily double as a child’s toy also serves as an ancient mathematical puzzle, the Towers of Hanoi. Often used to teach recursive problem solving strategies, the puzzle poses a simple challenge—to move the stack of disks from the leftmost peg to the rightmost peg one disk at a time with one restriction: a disk cannot be placed on top of a smaller disk.

Take a moment to familiarize yourself with the puzzle by playing around with this online version. Setting the number of disks to 3 is a great place to start.

It may be surprising that, no matter how many disks there are, this problem is always solvable with just three pegs. Even more surprising, the optimal solution for any number of disks (the solution that requires the fewest number of moves) directly mirrors the rhythm of counting in binary.

Before diving into this optimal solution (in a later article), this article focuses on understanding what counting in binary looks like and explores the nature of different number systems.

Base-10

The number system we most commonly use involves counting in base-10, a natural choice given the number of fingers we have on our hands. Consider the number 104 for example. Let’s index the digits from right to left, beginning with zero:

  • the value at index 0 is 4,
  • the value at index 1 is 0,
  • and the value at index 2 is 1.

Because we are working in base-10, there are 10 possible values for each digit (0, 1, 2, 3, 4, 5, 6, 7, 8, or 9) and each index represents a consecutively larger power of 10 corresponding to its index. The number 104 can be expressed as the sum of powers of 10 as follows:

  • 10^0 * 4 (or 4 ones)
  • 10^1 * 0  (or 0 tens)
  • 10^2 * 1 (or 1 hundred).

Base-2

Let’s now consider how this same value would be written in a different base: base-2, or binary. The binary system has only 2 possible values for each digit (0 or 1) and is most useful in the field of computer science as it is easy to consider an electrical component as having one of two possible states (on or off). In the binary representation of a number, each index represents a consecutively larger power of 2 corresponding to its index.

After some calculation, we can express 104 as the sum of powers of 2 as follows:

  • 2^0 * 0 (or 0 ones)
  • 2^1 * 0 (or 0 twos)
  • 2^2 * 0 (or 0 fours)
  • 2^3 * 1 (or 1 eight)
  • 2^4 * 0 (or 0 sixteens)
  • 2^5 * 1 (or 1 thirty-two)
  • 2^6 * 1 (or 1 sixty-four)

Thus, the binary representation of 104 is 1101000.

Converting Between Bases

To round out this introduction to different counting systems, let’s actually go through the process of converting a value from one base to another.

Consider the base-10 value 2643. Although base-10 is standard, it is good practice to break apart the digits and understand how this value is written. From right to left, we have:

  • 10^0 * 3 (or 3 ones)
  • 10^1 * 4 (or 4 tens)
  • 10^2 * 6 (or 6 hundreds)
  • 10^3 * 2 (or 2 thousands)

Now we will determine how to express 2643 in base-8 by recursively answering the same question:

  • What is the largest power of 8 less than or equal to 2643?
    • The answer is 8^3 = 512, and we can fit five 512s into 2643 with 83 left over. 
  • What is the largest power of 8 less than or equal to 83?
    • The answer is 8^2 = 64, and we can fit one 64 into 83 with 19 left over. 
  • What is the largest power of 8 less than or equal to 9?
    • The answer is 8^1 = 9, and we can fit two 8s into 19 with 3 left over. 
  • What is the largest power of 8 less than or equal to 1?
    • The answer is 8^0 = 1, and we can fit three 1s into 3 with 0 left over. 

Putting it all together, from right to left, we have:

  • 8^0 * 3 (or 3 ones)
  • 8^1 * 2 (or 2 eights)
  • 8^2 * 1 (or 1 sixty-four)
  • 8^3 * 5 (or 5 five-hundred twelves)

Thus, the base-8 representation of 2643 is 5123.

The Value 10

One interesting tidbit about working across different number systems is how different values are represented by 10. In any arbitrary base-n system, the value 10 can be read as:

  • n^0 * 0 (or 0 ones)
  • n^1 * 1 (or 1 n)

Thus, in any base-n system, the value of 10 is exactly n. To get a bit existential, every number system is, to itself, base-10. 

References

  1. https://www.khanacademy.org/computing/computer-science/algorithms/towers-of-hanoi/a/towers-of-hanoi
  2. https://www.mathsisfun.com/games/towerofhanoi.html
  3. https://www.youtube.com/watch?v=2SUvWfNJSsM

Your journey starts here! Let’s talk!

ThemeRex © 2026. All rights reserved.
  Timothy Durham was convicted of rape when a test showed his DNA genotype matched the DNA recovered from the crime scene. Eye witnesses testified that Durham was in a different state at the time of the incident, but he wasn’t exonerated from his 3000 year sentence until follow up DNA analysis showed that the preliminary forensic analysis used in the trial was misinterpreted (Thomas et al.). DNA testing serves an invaluable part in our criminal justice system, but it comes with complications and bias that can lead to wrongful convictions and misinformed juries.  

Background:

Forensic genetics aims to identify the origin of a biological sample. It can be traced back to Karl Landsteiner who discovered human ABO blood groups. With blood groups, suspects could be eliminated based on their blood type. For example, if a suspect had type A blood and there was type B blood left at the scene by the perpetrator, the investigators could rule out the suspect. Unfortunately, the reverse didn’t work. If the suspect and perpetrator both had the same blood type, it can’t be concluded that the suspect was guilty. Blood identifiers evolved into 8 distinct categories which improved the ability to eliminate suspects, but could only conclude that (if the system matched) it might be the perpetrator or this person might be related to the perpetrator (Jobling and Gill). The field evolved in the 1980s with the discovery of Minisatellites, lines of repetitive DNA that don’t encode proteins. Minisatellite patterns in DNA create what we know today as the DNA fingerprint, and it has a much higher accuracy rate than previous methods (Augustyn et al.). Around the same time, a breakthrough for victims of sexual assault was discovered. In the case of assault, bodily fluids of both the victim and the assaulter can get mixed. A process called differential lysis was created which could selectively increase the concentration of sperm in a fluid sample thereby allowing for accurate DNA testing (Jobling and Gill). Forensics evolved to use single-locus probe testing after several years because of its ease of interpretation. It looked at specific minisatellites that had high variability between subjects. This was the first DNA-based method to be used in a criminal investigation. Two murder homicides from several years apart were connected using DNA evidence. The evidence was then used to exonerate an innocent man, and the guilty party was found when he tried to evade mandatory DNA testing for all men in the small town. His guilt was then reinforced when the DNA profiles matched, and he gave a confession (Jobling and Gill). Finding DNA at a crime scene doesn’t guarantee that you’ll find a murderer. There are issues with non-pure samples and limited samples that make DNA work difficult, and accreditation of facilities and new techniques and take time (Jobling and Gill).  

Subjectivity of DNA Interpretation:

In a 2009 publication, the National Academy of Science discusses the possibility for subjective influence in lab based forensics. The interpretation bias happens in complex cases where, for example, there could be a mixture of DNA. A study published in 2011 looked specifically at this issue. A gang rape happened in Georgia, and the mixture in DNA from the case was used to prosecute one suspect after another suspect took a plea bargain to testify against him. With DNA mixtures, there are three possible conclusions: suspect excluded, suspect cannot be excluded, and inconclusive. If the suspect is excluded, it means that there’s little to no possibility that his DNA is part of the sample. If the suspect cannot be excluded, it means that there’s a possibility that his DNA is part of the sample. In the trial, the DNA examiners who knew the context of the case concluded that the suspect being prosecuted could not be excluded. The 2011 study gave the DNA evidence from this case and the DNA profiles of the suspects to 17 forensic examiners. These examiners had no context of the case, and they all worked independently. Of the 17, only 1 came to the same conclusion (suspect cannot be excluded) as the examiners who knew the context of the case. Twelve of the 17 concluded that the suspect who was prosecuted and convicted had no relation to the DNA found in the sample. Not only does this show that subjectivity occurs due to the context of the case, but the 17 examiners came up with different findings based on their past experiences meaning that not all DNA analysis is objective. Some organizations like the Scientific Working Group on DNA Analysis Methods say that quantitative statistical evidence should be presented with every categorical conclusion, but the US doesn’t require this (Dror and Hampikian).

False Positives:

There are two categories that cause wrongful identification in a DNA report: coincidental matches and false positives. Coincidental matches are DNA matches between two unrelated people. The probability of these matches is about 1 to 500,000 for white individuals and about 1 to 350,000 for black individuals. This small probability of coincidental matches makes people feel confident in DNA evidence. False positives, on the other hand, are matches between DNA and test DNA that result from issues in the forensics lab. There have been multiple cases of forensics labs accidentally switching victim and suspected rapist DNA which lead to convictions that were later overturned when the lab realized the error. There are also cases of misreading or misunderstanding a sample. In a case from 1993, a man was convicted of rape because someone interpreted a mixed sample of victim and perpetrator DNA as an individual sample. The conviction was again overturned. To prevent false convictions, retesting DNA is allowed, but it’s not an efficient solution. Many people are pushing for statistical information on the probability of false positives, so that the jurors can make accurate judgements based on DNA evidence (Thomas et al.).  

Conclusion:

DNA analysis is a useful tool for the criminal justice system, but subjectivity can be an issue in forensic testing. To combat wrongful convictions, there are organizations like The Innocence Project who use DNA testing to free the innocent, but reformed forensic testing standards should be put in place to prevent subjectivity and to ensure juries are correctly informed during trials. https://www.innocenceproject.org/    

Citation:

Augustyn , Adam, et al. “DNA Finerprinting.” Encyclopedia Britannica , 26 Apr. 2018, www.britannica.com/science/DNA-fingerprinting#ref153186. Dror, Itiel E., and Greg Hampikian. “Subjectivity and Bias in Forensic DNA Mixture Interpretation.” Science & Justice, vol. 51, no. 4, 2011, pp. 204–208., doi:10.1016/j.scijus.2011.08.004. Jobling, Mark A., and Peter Gill. “Encoded Evidence: DNA in Forensic Analysis.” Nature Reviews: Genetics, vol. 5, no. 10, Oct. 2004, pp. 739–751., doi:10.1038/nrg1455. Thompson, William C, et al. “How the Probability of a False Positive Affects the Value of DNA Evidence.” Journal of Forensic Sciences, vol. 48, no. 1, Jan. 2003, pp. 1–8., doi:10.1520/jfs2001171.