## All About Binary

The electrical/computational world around us is completely encoded in binary, or base-2. Between Wednesday and Friday, we did the following.

• Converted numbers from base 2 to base 10.
• Converted numbers from base 10 to base 2 (a bit more tricky).
• Added numbers in binary. (See this tutorial)
• Multiplied numbers by 2 in binary. (See my in my office for questions on this.)
• Considered a famous problem in mathematics that was formed to be computed in binary.
• Considered parity check functions for detecting when an evil scrambler or environmental factors swap digits in a binary stream.

## A Quick Parity Check Function

I am going to be sending you a message that is 6 bits long, representing a number. A problem that can and does occur in this process is that a bit or two may get scrambled during transmission. So, I will append a “parity check digit” to the front of my message. If the message has the label $m$, then the parity check function will be $p(m)$ and it will have the value

$p(m)=\begin{cases}0 & \text{if the number of 1s in m is even}\cr 1 & \text{if the number of 1s in m is odd}\end{cases}.$

So, the message I am sending now looks something like $p(m)\ |\ m$. For instance, if I wanted to send you the number 5, my initial message would be $m=000101$, representing the number 5 in binary. Now, since there are an even number of 1s in this message, we have $p(m)=0$, and so our seven bit message now reads $0000101$. When the person on the other end receives this message, they will be able to detect if any single bit has been changed.

## The Limitations of Computers

Most modern computers are 64-bit machines, meaning that each block of data they consider is 64-bits in length. This page contains information far beyond the scope of this class, but the table near the top of the page shows how large various types of integers can be based on how many bits are used to store the integer. When we are working in a computer system that isn’t capable of working with big enough integers, we have a situation called “overflow.” When programmers make an error in not knowing the limitations of their computers, big things can go wrong as a result. A classic example is the Ariane 5 rocket explosion.