3 Ways to Learn Hexadecimal

Table of contents:

3 Ways to Learn Hexadecimal
3 Ways to Learn Hexadecimal

Video: 3 Ways to Learn Hexadecimal

Video: 3 Ways to Learn Hexadecimal
Video: FASTEST Way to Learn Coding and ACTUALLY Get a Job 2024, December
Anonim

The hexadecimal (base sixteen) number system is used throughout the Web and computer systems to represent values. One great example is color coding on HTML pages. Reading and using hexadecimal takes practice, but the basic concepts are no more difficult than the decimal (base ten) system you've been using your whole life.

Step

Method 1 of 3: Understanding Hexadecimal Concepts

Understand Hexadecimal Step 1
Understand Hexadecimal Step 1

Step 1. Understand what hexadecimal is

Just as the decimal number system uses ten different symbols to represent values from zero to nine, the hexadecimal number system uses sixteen different symbols to represent values from zero to fifteen. Any number can be written using these two systems. Here's how to start counting in hexadecimal:

  • Zero to fifteen: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
  • Sixteen to thirty-two: 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F, 20.
Understand Hexadecimal Step 2
Understand Hexadecimal Step 2

Step 2. Understand how to write a base

The ten symbols used in the decimal number system form the basis of the decimal number system. In the same way, the sixteen symbols used in the hexadecimal number system form the basis of the hexadecimal number system. To distinguish which base system is used, the number subscript added to differentiate them. For example, 10010 represents "100 in base 10" and 10016 represents "100 in base 16" (which is equal to 409610).

Another term for "base" is "radix"

Understand Hexadecimal Step 3
Understand Hexadecimal Step 3

Step 3. Understand place values in decimals

We can understand long strings of numbers written in base 10 without even stopping to think, but that's only because we've done a lot of practice. We know automatically that "583410" means 5x103 + 8x102 + 3x101 + 4x100. Each digit in a multi-digit number has its own place value. Here are the place values in decimal, from right to left:

  • 10010 = 1
  • 10110 = 1010
  • 102 = 10 x 10 = 100
  • 103 = 10 x 10 x 10 = 1000
  • 104 = 10 x 10 x 10 x 10 = 10000
  • 105 = 10 x 10 x 10 x 10 x 10 = 100000 and so on.
Understand Hexadecimal Step 4
Understand Hexadecimal Step 4

Step 4. Understand the hexadecimal place values

Since hexadecimal is base sixteen, its place value is based on the power of the number sixteen, not ten. Here is the power of sixteen, written in decimal.

  • 16010 =

    Step 1.

  • 16110 =

    Step 16.10

  • 162 = 16 x 16 = 256
  • 163 = 16 x 16 x 16 = 4096
  • 164 = 16 x 16 x 16 x 16 = 65536
  • 165 = 16 x 16 x 16 x 16 x 16 = 1048576 etc.
  • If we write it in hexadecimal, it will be written as 1016, 100, 1000, and so on.
Understand Hexadecimal Step 5
Understand Hexadecimal Step 5

Step 5. Convert hexadecimal to decimal

Conversions between two number bases are a good way to get to know how these systems work. Here's how to convert a number in hexadecimal to the same number in decimal:

  • Write your hexadecimal number: 15B3016.
  • Write each digit as a decimal multiplication sentence, using the place values in the graph above: 15B30 = (1 x 6553610) + (5 x 409610) + (B x 25610) + (3 x 1610) + (0 x 1).
  • Convert non-decimal numbers to decimal numbers. In this example, B = 1110, so the digit can be converted to 1110 x 25610.
  • Solve the math equation. Use a calculator or do it by hand, and you'll get the answer in decimal. 15B30 = 65536 + 20480 + 2816 + 48 + 0 = 8888010.

Method 2 of 3: Understanding the Hexadecimal Color Code System

Understand Hexadecimal Step 6
Understand Hexadecimal Step 6

Step 1. Understand how color codes on computer screens are determined

All colors on a computer screen are determined by three values: red (red), green (green), and blue (blue). All colors of light can be created by combining these three types of light in different proportions. On a computer screen, red, green, and blue can represent any value from 0 to 255 (for a total of 256 possible values).

This is different from the "primary" color system you learn about in school, because it is based on physical pigments (such as paint), not light. The paint color system is sometimes called the "subtractive color system" and the light system (the rgb system described here) is called the "additive color system"

Understand Hexadecimal Step 7
Understand Hexadecimal Step 7

Step 2. Understand why hexadecimal is used for color coding

HTML uses hexadecimal to represent colors. This is very good, because a two-digit hexadecimal number can convey exactly 25610 possible value. This is no coincidence; quantity 25610 related to the hardware limitation of the old model, which can only handle 1000000002 or 25610 color. because 24 = 1610, any binary system can be easily converted to the hexadecimal system by the number of digits of its.

Number subscript indicates in what basis the number is written. Base2 is binary base, base10 is a regular decimal, and base16 is hexadecimal.

Begin a Short Story Step 13
Begin a Short Story Step 13

Step 3. Understand how the system works

The hexadecimal color system is easy to understand, if you know how it works. The first two digits are red values, the next two digits are green values, and the last two digits are blue values. Here are some examples:

  • #000000 is black, while #FFFFFF is white.
  • A color with the same r, g, and b values (other than black and white) is gray, such as #121212, #5A5A5A, or #C0C0C0.
  • #003000 is dark green. #003F00 is a bit lighter (you just added F, or 16. green10), while #00FF00 is the brightest green that can form (with the addition of C0, or 19210).
  • More complex colors are created using these three types of light. Guess which color is #7FFFD4, #8A2BE2, or #A0522D.

Method 3 of 3: Think in Hexadecimal

Understand Hexadecimal Step 9
Understand Hexadecimal Step 9

Step 1. Train yourself to read hexadecimal intuitively

Use the examples below as "stepping stones" to help you estimate the size of a hexadecimal number. This can give you a more intuitive understanding of hexadecimal, and give you the opportunity to read hexadecimal numbers without the hassle of converting them to decimal every time. As you'll see, one of the advantages of hexadecimal is that the number of digits doesn't increase as quickly as in decimal:

  • Humans have as many fingers as A, or 1416 if you count the toes too. (Remember, sign subscript 16 meaning numbers are written in base sixteen.)
  • In residential areas, drive under 1916 miles per hour (or 2816 kilometers per hour).
  • Driving speed on highways is generally 3C meters per hour (or 6416 kilometers per hour).
  • Water boils at D4 Fahrenheit (6416 Celsius).
  • The average American's income is roughly C350 dollars a year.
  • The world population is more than 1A0, 000, 000.
Understand Hexadecimal Step 10
Understand Hexadecimal Step 10

Step 2. Learn hexadecimal addition

You can work on hexadecimal addition problems without having to convert to another number system. It takes a little mental effort and practice to remember new rules. Here are some ways and tips:

  • Count one by one, using hexadecimal digits. For example to solve 7+5 in hex, calculate 7, 8, 9, A, B, C.
  • Understand the addition table. The quickest way is to memorize a hexadecimal addition table, which you can practice in an online quiz. When you know that A + 7 = 1116, you don't have to work hard to calculate it anymore.
  • Borrow one when needed. If addition requires you to skip F, "borrow one" as you normally would with a normal addition problem. For example, A+5 = F, A+6 = 1016, A+7 = 1116, etc. In the same way, 3A+6 = 4016, 3A+7 = 4116, etc.
Understand Hexadecimal Step 11
Understand Hexadecimal Step 11

Step 3. Learn hexadecimal multiplication

As with regular multiplication, the best way to become proficient at hexadecimal multiplication is to memorize the multiplication table. Here is a hexadecimal "6 times table" as an example (all hexadecimal numbers):

  • 6 x 1 = 6
  • 6 x 2 = C
  • 6 x 3 = 12
  • 6 x 4 = 18
  • 6 x 5 = 1E
  • 6 x 6 = 24
  • 6 x 7 = 2A
  • 6 x 8 = 30
  • 6 x 9 = 36
  • 6 x A = 3C
  • 6 x B = 42
  • 6 x C = 48
  • 6 x D = 4E
  • 6 x E = 54
  • 6 x F = 5A

Tips

  • You can use an online conversion calculator to convert binary, decimal, and hexadecimal numbers.
  • Binary numbers can be easily written in hexadecimal form. Divide the binary number into four-digit parts (add a leading 0 if needed), then replace each part with its equivalent hexadecimal digit. For example, 00002 = 016, 00012 = 116 … continue until 11112 = F16.
  • Computers actually use the "complement" method for addition and subtraction (in hexadecimal or some other number base), not the "borrow" method we are used to. The complement method is not a very useful method for humans, but if you program computation software, you should learn it to make your program more efficient.

Recommended: