The binary numeral system, or base-2 number system, represents numeric values using two symbols, 0 and 1.
Owing to its straightforward implementation in digital electronic circuitry using logic gates, the binary system is used internally by all modern computers.
It is possible to do arithmetic in base two, e.g. 3+5 is written:
<math> \begin{array}{cccc} & 0 & 0 & 1 & 1 \\ + & 0 & 1 & 0 & 1 \\ \hline & 1 & 0 & 0 & 0 \\ \end{array} </math>
The addition works like normal (base-10) arithmetic, where:
<math> \begin{array}{cccc} & & 1 \\ + & & 1 \\ \hline & 1 & 0 \\ \end{array} </math> where 1 + 1 = 0 with a carry of 1 and 1 + 0 = 1
Subtraction, multiplication, etc. work this way:
<math> \begin{array}{cccc} & & \textit{1} & \textit{1} & & \textit{carried digits} \\ \\ & 0 & 0 & 1 & 1 & \\ + & 0 & 1 & 0 & 1 &\\ \hline & 1 & 0 & 0 & 0 & \\ \end{array} </math>
Using Arabic numerals, binary numbers are commonly written using the symbols 0 and 1.
Number | Binary coding |
---|---|
0 | 0000 |
1 | 0001 |
2 | 0010 |
3 | 0011 |
4 | 0100 |
5 | 0101 |
6 | 0110 |
7 | 0111 |
8 | 1000 |
……. | |
14 | 1110 |
15 | 1111 |
……. |
1.01 in base-2 notation is 1 + 0/2 + 1/4, or 1.25 in decimal notation.
Binary | Hexadecimal |
---|---|
0 | 0 |
1 | 1 |
10 | 2 |
11 | 3 |
100 | 4 |
101 | 5 |
110 | 6 |
111 | 7 |
1000 | 8 |
1001 | 9 |
1010 | A |
1011 | B |
1100 | C |
1101 | D |
1110 | E |
1111 | F |
Hexadecimal is then to easier write. For example, the binary number “100110110100” is “9B4” in hexadecimal.