# Math help from the Learning Centre

This guide provides useful resources for a wide variety of math topics. It is targeted at students enrolled in a math course or any other Centennial course that requires math knowledge and skills.

## Number Systems

The system we are use to runs through a decimal system with base 10. However, computers are not programmed through base 10 systems. Early computers were programmed with base 2 (binary), base 8 (octal), and base 16 (hexadecimal) systems. While any number can be a base, below we will focus on operations with decimal, binary, octal, and hexadecimal systems.

Decimal numbers can be represented in terms of base 10.

For example,

$3248 = 3\times \mathbf{10^3} + 2\times \mathbf{10^2} + 4\times \mathbf{10^1} + 8\times \mathbf{10^0}$

Notice in the decimal system, digits can be any number from 0 to 9.

## Converting Different Number Bases to Decimals

The binary number system is of base 2. The digits in each place value are made up of 0s and 1s.

The octal number system is of base 8. The digits in each place value are numbers between 0 and 7.

Example: Convert the following binary numbers into decimal numbers

1. $$101_2$$

\begin{align}101_2 &= 1\times \mathbf{2^2} + 0\times\mathbf{2^1} + 1\times\mathbf{2^0}\\ &= 4 + 0 + 1 \\ &= 5\end{align}

Notice 0 multiplied by any number equals 0, so we can simplify our calculations.

2. $$100001111_{two}$$

\begin{align}100001111_{two} &= 1\times \mathbf{2^8} + 1\times\mathbf{2^3} + +1\times\mathbf{2^2}+1\times\mathbf{2^1}+1\times\mathbf{2^0}\\ &= 256 + 8 + 4 + 2 + 1 \\ &= 271\end{align}

3. $$463_8$$

\begin{align}463_8 &= 4\times \mathbf{8^2} + 6\times\mathbf{8^1} + 3\times\mathbf{8^0}\\ &= 256 + 48 + 3 \\ &= 307\end{align}

4. $$5072_{eight}$$

\begin{align}5072_{eight} &= 5\times \mathbf{8^3} + 7\times\mathbf{8^1} + 2\times\mathbf{8^0}\\ &= 2560 + 56 + 2 \\ &= 2618\end{align}

## Converting Decimals into Different Bases

To convert decimals into different bases, since the above was a series of multiplications. We now use a series of divisions of the decimal by the base number and use the remainders.

Example: Convert the decimals into the appropriate base.

1. 87 to binary

\begin{align} 87 \div 2 &= 43 &remainder\, 1 \\ 43\div 2 &= 21& remainder\, 1 \\ 21\div 2 &= 10& R\,1 \\ 10 \div 2 &= 5& R\,0 \\ 5\div 2 &= 2& R\,1 \\ 2\div 2 &= 1& R\,0 \\ 1\div 2 &= 0& R\,1 \end{align}

The final answer is the remainders of the number read from the last step back to the first step.

$1010111_2$

2. 3262 to octal

\begin{align} 3262\div 8 &= 407 &R\, 6 \\ 407\div 8 &= 50&R\, 7 \\ 50\div 8 &= 6&R\,2 \\ 6 \div 8 &= 0&R\,6 \end{align}

$6276_8$

\begin{align}6276_8&=6\times \mathbf{8^3}+2\times \mathbf{8^2}+7\times \mathbf{8^1}+6\times \mathbf{8^0}\\&=3072+128+56+6\\&=3262\end{align}

Note: To find the remainder in your calculator $$3262\div 8 = 407.75$$ take the decimal .75 and multiple by base 8 to find the remainder 6.

The hexadecimal system is a base 16 system. That means the digits in each place value are between 0 and 15. Since the decimals 10 to 15 can be seen as two place values, we use letters to represent the two digit numbers.

 Decimal Hexadecimal 10 A 11 B 12 C 13 D 14 E 15 F

Example: Convert $$A3D7_{16}$$ to decimal

$$A=10$$ and $$D=13$$

\begin{align} A3D7_{16} &= 10 \times \mathbf{16^3} + 3 \times \mathbf{16^2} + 13 \times \mathbf{16^1} + 7 \times \mathbf{16^0} \\ &= 40,960+768+208+7\\&=41,943\end{align}

\begin{align} 52,382\div 16 &= 3273& R\, 14=E \\ 3273\div 16 &= 204&R\, 9 \\ 204\div 16&= 12& R\,12=C \\ 12\div 16&= 0& R\,12=C \end{align}

The answer is $$CC9E_{16}$$. You can check the answer.

## Converting Between Different Bases

To convert $$100110_2$$ to octal. We could convert the binary number into a decimal first and then convert the decimal to octal.

Binary to decimal (by sums of multiplications): $$100110_2=38$$

Decimal to octal (by a sequence of divisions): $$38=46_8$$

There is a shortcut since $$2^3=8$$ this means every three binary digits are equivalent to one octal digit.

Therefore,

\begin{array}{cc} \underline{100}&\underline{110_2} \\ 4&6_8\end{array}

$100\,\, 110_2=46_8$

Convert $$10010101_2$$ to octal

\begin{array}{ccc} \underline{10}& \underline{010}&\underline{101_2} \\ 2&2&5_8\end{array}

We can use a similar process for binary to hexadecimal since $$2^4=16$$, thus every four binary digits equals to one hexadecimal digit.

Convert $$111011110_2$$ to hexadecimal

\begin{array}{ccc} \underline{1}& \underline{1101}&\underline{1110_2} \\ 1&D&E_{16}\end{array}

Convert to $$571_8$$ to binary

\begin{array}{ccc} 5&7&1_8\\\underline{101}& \underline{111}&\underline{001_2} \end{array}

So, $$571_8=101\,111\,001_2$$

Convert $$E4A_{16}$$ to binary

\begin{array}{ccc} E&4&A_{16}\\\underline{1110}& \underline{0100}&\underline{1010_2} \end{array}