User Tools

Site Tools


howto:hambasics:sections:mathbasics

Metric Prefix

A metric prefix is a unit prefix that precedes a basic unit of measure to indicate a multiple or fraction of the unit.

In the previous section, we saw that Mhz means a million Hertz. Here's a list of the most common ones:

Name Symbol Base 10 Decimal
Tera T 1012 1 000 000 000 000
Giga G 109 1 000 000 000
Mega M 106 1 000 000
Kilo k 103 1 000
hecto h 102 100
deca da 101 10
1001
deci d 10-1 0.1
centi c 10-2 0.01
milli m 10-3 0.001
micro μ 10-6 0.000 001
nano n 10-9 0.000 000 001
pico p 10-12 0.000 000 000 001

The decibel

A decibel (dB) is a way of saying how many times bigger (or smaller) something is compared to something else. For example, let's use the faintest sound that the human ear can detect as the basis. A normal conversation would be a million times louder, and a jack hammer would be a hundred billion times louder. To represent these vast differences in numbers, we use a logarithmic scale based on powers of 10.

Here's the idea. Start with representing numbers by exponents of 10:

Number Base 10 Exponent
1 =100 0
10 =101 1
100 =102 2
1000 =103 3
10 000 =104 4
100 000 =105 5
1 000 000 =106 6

If your math is a little rusty, notice how the exponent counts the number of zeros after the one (1 000 000 has 6 zeros so it's equal to 106)

For now, let's call the exponent a “bel” (not decibel yet). For example:

  • Instead of saying that a sound is 1000 times louder, we could say that it's 3 bels louder, and
  • Instead of saying that it's 10,000 times louder, we could say that it's 4 bels louder.

So the bel is just the number of zeros after the 1. But what if the number doesn't start with 1. For example: what if it's 5000 times louder?

  • Since 5000 is between 1000 and 10,000, it might be tempting to say that it would 3.5 bels louder (midway between 3 and 4), but let's check to see if it works: 103.5 = 3162, which is between 1000 and 10,000, but not 5000.
  • By trial and error, you might get pretty close: 103.7 = 5011... so 5000 times louder is roughly 3.7 bels.
  • But a faster way of finding the exponent of a base 10 number is to use the Log button on your calculator: \$\log(5000) \approx 3.699\$1)

In the same way that milli means a thousandth, and centi means a hundredth (think millimetre and centimetre), a deci means a tenth. So 1 bel contains 10 decibels (like 1 metre contains 10 decimetres, 100 centimetres, or 1000 millimetres).

So another way of saying 3.7 bels is to say 37 decibels, or 37 dB. So here's our table again with a few common “in between” numbers:

Number Base 10 Exponent (bels) decibels (dB)
1 =100 0 0
2 ≈100.3 0.3 3
4 ≈100.6 0.6 6
8 ≈100.9 0.9 9
10 =101 1 10
100 =102 2 20
1000 =103 3 30
10 000 =104 4 40
100 000 =105 5 50
1 000 000 =106 6 60

In addition to being more convenient to represent big numbers, decibels also allow us to multiply big (or small) numbers more easily by adding the dB instead. For example, look at:

  • 100 x 1000 = 100,000

Let's write the same thing again in powers of 10:

  • 102 x 103 = 105

Notice that while the numbers are multiplying (100 x 1000), the exponents are adding (2 + 3). So 100 x 1000 is the same as saying 20 dB + 30 dB = 50 dB. That is, adding the dB representation of numbers, is the same as multiplying those numbers.

Look back at the previous table; if you double the power, three times in a row:

  • The final power is 2 x 2 x 2 = 8 times more powerful than the original.
  • In terms of dB, we can instead add 3dB three times: 3dB + 3dB + 3dB = 9dB.

Here's a quick exercise: Using only the table above, what is the dB representation of 4000?

Click to display ⇲

Click to hide ⇱

A 4000 fold increase is the same as a 1000 fold followed by two doubling. That is:

  • 1000 x 2 x 2 = 4000

Which means:

  • 30dB + 3dB + 3dB = 36dB

Quick calculator check: 103.6 = 3981 ≈ 4000

So the only thing to memorize with decibels is that:

  • a bel (10 dB) is the number of zeros after the 1. So that takes care of knowing 10dB, 20dB, 30dB, ...
  • 3dB is one doubling.

With these two things, we can now estimate a bunch of in between numbers like 36dB (30dB + 3dB + 3dB), or 13dB (10dB + 3dB)


Here's Dave explaining this in more details:

Alternative Formulation

If you like formulas, what I did above was define the dB implicitly as:

\$$ \text{ratio} = 10^{\left(\frac{\text{dB}}{10} \right)} \$$

For example, a ratio of 1000 is equivalent to 30 dB because:

\$$ 1000 = 10^{\left(\frac{\text{30}}{10} \right)} \$$

But what you'll often find in books is the following explicit definition:

\$$ \text{dB} = 10\log\left(\text{ratio}\right) \$$

While the two are definitions are mathematically equivalent2), I personally prefer the implicit definition because I find it easier to picture the dB in terms of powers of 10, where as I can't really picture the log function that well. But they are equivalent, so use the one you like most.

dBm

A related measurement is the dBm. While the decibel (dB) is a ratio between two quantities (saying “20 dB” is the same as saying “100 times more”), the dBm is a ratio between one quantity and 1 mW. That is, it's a measures of how much stronger (or weaker) the power of something is compared to 1 milliwatt.

For example, a typical fibre optic light signal to a house for internet has a light level of -16 dBm. Before we go through the math, recall that 16 dB = 10 dB + 3 dB + 3 dB. Which means, the ratio is 10 × 2 × 2 = 40. Let's now see why -16 dBm is equal to a power of 25 μW (microwatts):

\$$-16 \text{ dBm} = 1 \text{ mW} \div 10^{1.6} \approx 1 \text{ mW} \div 40 = 0.025 \text{ mW} = 25~\mu \text{W} \$$

Notice how the minus sign in front of the dBm means that the power is less (not more) so it's divides (not multiply).

Binary Numbers

Base 10

It's kind of weird explaining how to count in base 10 because we're so used to it. But to understand other bases, it helps to understand how base 10 really works first.

So base 10 means we have 10 different symbols to represent numbers, and when we need more, we just add more digits to the number. For example, let's count and pay close attention to what we're really doing:

  • With one digit, we can count to nine because we have ten symbols: \$$0, 1, 2, 3, 4, 5, 6, 7, 8, 9\$$
  • To continue past nine, we need to add a new digit in front of the “counting digit”, and then we just do what we did above again: \$$10, 11, 12, 13, 14, 15, 16, 17, 18, 19\$$
  • And that new digit will increase in the same way until we run out of symbols: \$$20, 21, 22, 23, 24, 25, 26, 27, 28, 29\$$ \$$ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39\$$ \$$\vdots \$$ \$$ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 \$$
  • At which point we need to add a third digit (and so on).

It's strange to think about this but the ability to count is completely separate from having a sense of how big the numbers are. What I mean is: if you know how to change the symbols (from 0 to 1, and 1 to 2, and 2 to 3, etc) and how to add new digits (9 to 10, 99 to 100, ...) you can count forever without having a “number sense”. In base 10, it's hard to imagine not knowing how big a number is, but we'll actually do this in base 2 in a moment. You'll see, it's a weird feeling!

But first, here's another weird way to think of numbers. Take 234 for example. Let's “decompose” it into its powers of 10:

\begin{align*} {\color{teal}{234}} &= {\color{teal}2}\times 100 + {\color{teal}3}\times 10 + {\color{teal}4}\times 1 \\ &= {\color{teal}2}\times 10^2 + {\color{teal}3}\times 10^1 + {\color{teal}4}\times 10^0 \end{align*}

This is a very tedious way of expressing a simple number, but I promise it'll be invaluable when we try to convert from base 2 to base 10 in a moment (can you think of why?).

Base 2

Now let's do the same thing again in base 2. Imagine we only have two symbols we can use to count: 0 and 1. Let's see what counting to thirteen looks like starting at zero:

0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101

Do you see the pattern? Here's another way of writing it with leading zeros and keeping track of where we are in base 10:

Base 2 Base 10
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 10
1011 11
1100 12
1101 13

You see what I mean about being able to count without knowing how big the number is? If we wanted, we could count to 1001010011010 and have no idea of how big that number is unless we kept track of it in base 10. That's because over the years, we developed a number sense for base 10 numbers, but we didn't for base 2 numbers since we don't typically use them.

Conversion

Now let's look at how to convert from one base to the other without counting.

Base 2 to Base 10

We'll use our example of 1101 in base 2 since we already know it's 13 in base 10. Before we do this, however, let's use subscripts to denote the base. For example, we'd write:

\$$ 1101_2 = 13_{10} \$$

Now let's see how we convert from base 2 to base 10 without counting. In the same way that each position in base ten is a factor of 10, each position in base 2 is a factor of 2:

\begin{align*} {\color{teal}{1101}}_2 &= {\color{teal}1}\times 2^3 + {\color{teal}1}\times 2^2 + {\color{teal}0}\times 2^1 + {\color{teal}1}\times 2^0 \\ &= {\color{teal}1}\times 8 + {\color{teal}1}\times 4 + {\color{teal}0}\times 2 + {\color{teal}1}\times 1 \\ &= 8 + 4 + 0 + 1 \\ &= 13_{10} \end{align*}

Let's try that again with the crazy number I mentioned earlier: 1001010011010. Skipping the powers with a coefficient of 0 (to save space): \begin{align*} 1001010011010_2 &= 2^{12} + 2^9 + 2^7 + 2^4 + 2^3 + 2^1 \\ &= 4096 + 512 + 128 + 16 + 8 + 2 \\ &= 4762_{10} \end{align*}

Base 10 to Base 2

Converting the other way around is a bit different, but kind of makes sense if you think about it. Here are the steps to convert \$ 13_{10} \$ back to \$1101_2\$ and I'll explain a bit more after:

Division by 2 In Decimal As fraction Quotient Remainder
13÷2 6.5 6 + \$\frac{1}{2}\$ 6 1
6÷2 3.0 3 + \$\frac{0}{2}\$ 3 0
3÷2 1.5 1 + \$\frac{1}{2}\$ 1 1
1÷2 0.5 0 + \$\frac{1}{2}\$ 0 1

Now we read the remainders from the bottom up: 1101.

Recall that the remainder is what's left of a division; it's not the decimal portion. For example:

\begin{align*} 22 \div 5 &= 4.4 \\ &= 4 \tfrac{2}{5} \\ &= 4 \text{ remainder 2 (of 5)} \end{align*}

In our case, the remainder is what's left after we divided by 2. So why does this method work?

What we really want to do is decompose 13 into the sum of its powers of 2. That is: \begin{align*} 13_{10} &= \; 8 + 4 + 0 + 1 \\ &= \; 2^3 + 2^2 + 0 + 2^0 \\ &= (1 \quad \ \ 1 \quad \ \ \, 0 \quad \ 1)_2 \end{align*}

When we have a non-zero power of 2, we represent that position with a 1, when we have a zero power of 2, we write 0.

What the table above is doing is systematically dividing by 2 to see if the result is a whole number or not. If it is, it means that that position is 0 because the factor of two can be absorbed further up the chain. For example, the fact that 13 ÷ 2 = 4.5 means that the first digit has to be 1.

Let's look at a trivial example converting 2037 from base 10 to base 10 (trivial indeed!):

Division by 10 In Decimal As fraction Quotient Remainder
2037÷10 203.7 203 + \$\frac{7}{10}\$ 203 7
203÷10 20.3 20 + \$\frac{3}{10}\$ 20 3
20÷10 2 2 + \$\frac{0}{10}\$ 2 0
2÷10 0.2 0 + \$\frac{2}{10}\$ 0 2

Other Bases?

There are other useful bases such as hexadecimal (base 16). Here's an example of counting to twenty in hex:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12, 13, 14

The convention to denote a hexadecimal number is to use either \$ 14_{16} \$ or 0x14.

The same logic applies to convert between hexadecimal and base 10:

\begin{align*} \text{F61B}_{16} &= 15 \times 16^3 + 6 \times 16^2 + 1 \times 16^1 + 11 \times 16^0 \\ &= 15 \times 4096 + 6 \times 256 + 1 \times 16 + 11 \\ &= 63003_{10} \end{align*}

1)
Depending on your calculator, you might have to type it in this order 5000Log
2)
These two definitions are equivalent because the log function is the inverse of the power function. That is, it helps us find the exponent when we know the other quantities. Mathematically, we say that: \$a = 10^b \quad \Leftrightarrow \quad b = \log_{10}(a) \$
howto/hambasics/sections/mathbasics.txt · Last modified: 2023/02/17 11:35 by va7fi