U2 Lesson 3 Hexadecimal Number System Slides PDF
Document Details

Uploaded by AffordableModernism5372
Tags
Summary
This document provides an overview of the hexadecimal number system. It explains why it's used in computer science and how to perform conversions between hexadecimal and decimal. It is a useful introduction to fundamental digital data structures and concepts.
Full Transcript
 [Today's Objectives:] Students will understand why  we have hexadecimal representations for digital data. Students will be able to convert between hexadecimal and decimal representations of numbers. Other Number Systems ∙ W...
 [Today's Objectives:] Students will understand why  we have hexadecimal representations for digital data. Students will be able to convert between hexadecimal and decimal representations of numbers. Other Number Systems ∙ We have several different number systems besides our base-10 and base 2 numbers systems, each for various purposes and applications. Other Number Systems  ∙ We have several different number systems besides our base-10 and base 2 numbers systems, each for various purposes and applications. Decimal (Base-10) System: ∙ It\'s well-suited for human cognition because we have ten fingers, which naturally lends itself to counting in base-10 Other Number Systems ∙ We have several different number systems besides our base-10 and base 2 numbers systems, each for various purposes and applications. Decimal (Base-10) System: ∙ It\'s well-suited for human cognition because we have ten fingers, which naturally lends itself to counting in base-10 ∙ It\'s convenient for representing and performing arithmetic on small to medium sized numbers Binary (Base-2) System: ∙ Computers use binary as their native language, representing all data and instructions as sequences of 0s and 1s Binary (Base-2) System: ∙ Computers use binary as their native language, representing all data and instructions as sequences of 0s and 1s ∙ Binary is well-suited for electronic devices because it\'s easy to represent using voltage levels Binary (Base-2) System: ∙ Computers use binary as their native language, representing all data and instructions as sequences of 0s and 1s ∙ Binary is well-suited for electronic devices because it\'s easy to represent using voltage levels ∙ It simplifies digital logic design and is the foundation of modern computer systems Binary (Base-2) System: ∙ Computers use binary as their native language, representing all data and instructions as sequences of 0s and 1s ∙ Binary is well-suited for electronic devices because it\'s easy to represent using voltage levels ∙ It simplifies digital logic design and is the foundation of modern computer systems Hexadecimal (Base-16) System: ∙ Hexadecimal is often used in computing as a more human-friendly representation of binary data. Binary (Base-2) System: ∙ Computers use binary as their native language, representing all data and instructions as sequences of 0s and 1s ∙ Binary is well-suited for electronic devices because it\'s easy to represent using voltage levels ∙ It simplifies digital logic design and is the foundation of modern computer systems Hexadecimal (Base-16) System: ∙ Hexadecimal is often used in computing as a more human-friendly representation of binary data. ∙ Each hexadecimal digit corresponds to four bits, making it easier to read and work with long binary numbers. Binary (Base-2) System: ∙ Computers use binary as their native language, representing all data and instructions as sequences of 0s and 1s ∙ Binary is well-suited for electronic devices because it\'s easy to represent using voltage levels ∙ It simplifies digital logic design and is the foundation of modern computer systems Hexadecimal (Base-16) System: ∙ Hexadecimal is often used in computing as a more human-friendly representation of binary data. ∙ Each hexadecimal digit corresponds to four bits, making it easier to read and work with long binary numbers. ∙ It\'s commonly used in programming and debugging, especially when dealing with memory addresses and low-level data manipulation. Octal (Base-8) System: ∙ Octal has fewer applications today than hexadecimal, but it was historically used in early computer systems Octal (Base-8) System: ∙ Octal has fewer applications today than hexadecimal, but it was historically used in early computer systems ∙ It\'s a compact representation of binary, with each octal digit corresponding to three bits Octal (Base-8) System: ∙ Octal has fewer applications today than hexadecimal, but it was historically used in early computer systems ∙ It\'s a compact representation of binary, with each octal digit corresponding to three bits ∙ Octal was useful in the past for simplifying hardware design and programming, but it has been largely replaced by hexadecimal Octal (Base-8) System: ∙ Octal has fewer applications today than hexadecimal, but it was historically used in early computer systems ∙ It\'s a compact representation of binary, with each octal digit corresponding to three bits ∙ Octal was useful in the past for simplifying hardware design and programming, but it has been largely replaced by hexadecimal Other Base Systems: ∙ There are other less common base systems like ternary (base-3), quaternary (base-4), etc., but they are not as widely used as the ones mentioned above Octal (Base-8) System: ∙ Octal has fewer applications today than hexadecimal, but it was historically used in early computer systems ∙ It\'s a compact representation of binary, with each octal digit corresponding to three bits ∙ Octal was useful in the past for simplifying hardware design and programming, but it has been largely replaced by hexadecimal Other Base Systems: ∙ There are other less common base systems like ternary (base-3), quaternary (base-4), etc., but they are not as widely used as the ones mentioned above ∙ Some of these systems have been explored for specialized applications, but they haven\'t gained significant traction due to the convenience and familiarity of binary and hexadecimal Hexadecimal ∙ Hexadecimal (Base-16) number system uses 16 symbols: 0 -- 9 and A -- F Hexadecimal ∙ Hexadecimal (Base-16) number system uses 16 symbols: 0 -- 9 and A -- F ∙ As hexadecimal saves space (either paper space or screen space), you can more efficiently use hex instead of a large number of ones and zeros in binary. Hexadecimal ∙ Hexadecimal (Base-16) number system uses 16 symbols: 0 -- 9 and A -- F ∙ As hexadecimal saves space (either paper space or screen space), you can more efficiently use hex instead of a large number of ones and zeros in binary. ∙ Keep in mind that hexadecimal is NOT a form of data compression, nor is it a \"language\" that the computer reads. It is a different view into representing numbers. Here is a table of the hexadecimal symbols and their decimal representation: Decimal Representation (Base-10) Hexadecimal Representation Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F Here is a table of the hexadecimal symbols and their decimal representation: Decimal Representation (Base-10) 0 1 2 3 4 5 6 7 8 9 Hexadecimal Representation Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F Here is a table of the hexadecimal symbols and their decimal representation: Decimal Representation (Base-10) 0 1 2 3 4 5 6 7 8 9 10 Hexadecimal Representation Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F Here is a table of the hexadecimal symbols and their decimal representation: Decimal Representation (Base-10) 0 1 2 3 4 5 6 7 8 9 10 11 Hexadecimal Representation Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F Here is a table of the hexadecimal symbols and their decimal representation: Decimal Representation (Base-10) 0 1 2 3 4 5 6 7 8 9 10 11 12 Hexadecimal Representation Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F Here is a table of the hexadecimal symbols and their decimal representation: Decimal Representation (Base-10) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Hexadecimal Representation Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F Here is a table of the hexadecimal symbols and their decimal representation: Decimal Representation (Base-10) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Hexadecimal Representation Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F Here is a table of the hexadecimal symbols and their decimal representation: Decimal Representation (Base-10) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hexadecimal Representation Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F Here is a table of the hexadecimal symbols and their decimal representation: Decimal Representation (Base-10) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hexadecimal Representation Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F ∙ Similar to base-10 number system, the hexadecimal numbers use a base of 16, where each symbol in the hexadecimal number represents the multiplier of a base-16 Here is a table of the hexadecimal symbols and their decimal representation: Decimal Representation (Base-10) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hexadecimal Representation Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F ∙ Similar to base-10 number system, the hexadecimal numbers use a base of 16, where each symbol in the hexadecimal number represents the multiplier of a base-16 ∙ A52 as a hexadecimal number is written as A52~16~ to communicate what base it is To convert a hexadecimal number to decimal, you multiply each hexadecimal digit by the appropriate power of 16 and sum the results: A52~16~ To convert a hexadecimal number to decimal, you multiply each hexadecimal digit by the appropriate power of 16 and sum the results: A52~16~ ∙ 16^2^ + 5 ∙ 16^1^ + 2 ∙ 16^0^ To convert a hexadecimal number to decimal, you multiply each hexadecimal digit by the appropriate power of 16 and sum the results: A52~16~ ∙ 16^2^ + 5 ∙ 16^1^ + 2 ∙ 16^0^ Since A is the hexadecimal representation of 10, we will rewrite it as: 10 ∙ 16^2^ + 5 ∙ 16^1^ + 2 ∙ 16^0^ To convert a hexadecimal number to decimal, you multiply each hexadecimal digit by the appropriate power of 16 and sum the results: A52~16~ ∙ 16^2^ + 5 ∙ 16^1^ + 2 ∙ 16^0^ Since A is the hexadecimal representation of 10, we will rewrite it as: 10 ∙ 16^2^ + 5 ∙ 16^1^ + 2 ∙ 16^0^ 2560 + 80 + 2 To convert a hexadecimal number to decimal, you multiply each hexadecimal digit by the appropriate power of 16 and sum the results: A52~16~ ∙ 16^2^ + 5 ∙ 16^1^ + 2 ∙ 16^0^ Since A is the hexadecimal representation of 10, we will rewrite it as: 10 ∙ 16^2^ + 5 ∙ 16^1^ + 2 ∙ 16^0^ 2560 + 80 + 2 2642 To convert a hexadecimal number to decimal, you multiply each hexadecimal digit by the appropriate power of 16 and sum the results: A52~16~ ∙ 16^2^ + 5 ∙ 16^1^ + 2 ∙ 16^0^ Since A is the hexadecimal representation of 10, we will rewrite it as: 10 ∙ 16^2^ + 5 ∙ 16^1^ + 2 ∙ 16^0^ 2560 + 80 + 2 So, the hexadecimal number A52 is the decimal number 2642 2642 **Hexadecimal to Decimal Conversion Practice** 192~16~ ABC~16~ **Try it on your own!** 1 · 16^2^ + 9 · 16^1^ + 2 · 16^0^ 10 · 16^2^ + 11 · 16^1^ + 12 · 16^0^ 402 2748 2E4D~16~ C0FFEE~16~ **Hexadecimal to Decimal Conversion Practice** 192~16~ ABC~16~ 1 · 16^2^ + 9 · 16^1^ + 2 · 16^0^ 10 · 16^2^ + 11 · 16^1^ + 12 · 16^0^ 402 2748 2E4D~16~ C0FFEE~16~ **Hexadecimal to Decimal Conversion Practice** 192~16~ ABC~16~ 1 · 16^2^ + 9 · 16^1^ + 2 · 16^0^ 10 · 16^2^ + 11 · 16^1^ + 12 · 16^0^ 402 2748 2E4D~16~ C0FFEE~16~ **Hexadecimal to Decimal Conversion Practice** 192~16~ ABC~16~ 1 · 16^2^ + 9 · 16^1^ + 2 · 16^0^ 10 · 16^2^ + 11 · 16^1^ + 12 · 16^0^ 402 2748 2E4D~16~ C0FFEE~16~ 2 · 16^3^ + 14 · 16^2^ + 4 · 16^1^ + 13 · 16^0^ 12 · 16^5^ + 0 · 16^4^ + 15 · 16^3^ + 15 · 16^2^ + 14 · 16^1^ + 14 · 16^0^ 11,853 12648430 **Hexadecimal to Decimal Conversion Practice** 192~16~ ABC~16~ 1 · 16^2^ + 9 · 16^1^ + 2 · 16^0^ 10 · 16^2^ + 11 · 16^1^ + 12 · 16^0^ 402 2748 2E4D~16~ C0FFEE~16~ 2 · 16^3^ + 14 · 16^2^ + 4 · 16^1^ + 13 · 16^0^ 12 · 16^5^ + 0 · 16^4^ + 15 · 16^3^ + 15 · 16^2^ + 14 · 16^1^ + 14 · 16^0^ 11853 12,648,430 ∙ To convert a decimal number to hexadecimal, you divide the decimal number by 16 repeatedly and note the remainders. ∙ To convert a decimal number to hexadecimal, you divide the decimal number by 16 repeatedly and note the remainders. ∙ Then, you replace each remainder with the corresponding hexadecimal symbol. ∙ To convert a decimal number to hexadecimal, you divide the decimal number by 16 repeatedly and note the remainders. ∙ Then, you replace each remainder with the corresponding hexadecimal symbol. ∙ The result is the hexadecimal representation of the decimal number. ∙ To convert a decimal number to hexadecimal, you divide the decimal number by 16 repeatedly and note the remainders. ∙ Then, you replace each remainder with the corresponding hexadecimal symbol. ∙ The result is the hexadecimal representation of the decimal number. ∙ This is very similar to how we converted decimal numbers to binary, except we divided by 2. Convert 3457~10~ to its hexadecimal representation (yes, you will need a calculator): Convert 3457~10~ to its hexadecimal representation (yes, you will need a calculator): 3457 ÷ 16 = Convert 3457~10~ to its hexadecimal representation (yes, you will need a calculator): 3457 ÷ 16 = 216 R 1 Convert 3457~10~ to its hexadecimal representation (yes, you will need a calculator): 3457 ÷ 16 = 216 R 1 216 ÷ 16 = Convert 3457~10~ to its hexadecimal representation (yes, you will need a calculator): 3457 ÷ 16 = 216 R 1 216 ÷ 16 = 13 R 8 Convert 3457~10~ to its hexadecimal representation (yes, you will need a calculator): 3457 ÷ 16 = 216 R 1 216 ÷ 16 = 13 R 8 13 ÷ 16 = Convert 3457~10~ to its hexadecimal representation (yes, you will need a calculator): 3457 ÷ 16 = 216 R 1 216 ÷ 16 = 13 R 8 13 ÷ 16 = 0 R 13 (D) Convert 3457~10~ to its hexadecimal representation (yes, you will need a calculator): 3457 ÷ 16 = 216 R 1 216 ÷ 16 = 13 R 8 13 ÷ 16 = 0 R 13 (D) Convert 3457~10~ to its hexadecimal representation (yes, you will need a calculator): 3457 ÷ 16 = 216 R 1 216 ÷ 16 = 13 R 8 13 ÷ 16 = 0 R 13 (D) D81 **Decimal to Hexadecimal Conversion Practice** 290~10~ 290 ÷ 16 = 18 R 2 192~10~ 196 ÷ 16 = 12 R 0 18 ÷ 16 = 1 R 2 12 ÷ 16 = 0 R 12 1 ÷ 16 = 0 R 1 1 2 2 🡪 122~16~ 12 0 🡪 C0~16~ 590~10~ 590 ÷ 16 = 36 R 14 48879~10~ **Try it on your own!** **Decimal to Hexadecimal Conversion Practice** 290~10~ 290 ÷ 16 = 18 R 2 192~10~ 196 ÷ 16 = 12 R 0 18 ÷ 16 = 1 R 2 12 ÷ 16 = 0 R 12 1 ÷ 16 = 0 R 1 1 2 2 🡪 122~16~ 12 0 🡪 C0~16~ 590~10~ 590 ÷ 16 = 36 R 14 48879~10~ **Decimal to Hexadecimal Conversion Practice** 290~10~ 290 ÷ 16 = 18 R 2 192~10~ 192 ÷ 16 = 12 R 0 18 ÷ 16 = 1 R 2 12 ÷ 16 = 0 R 12 1 ÷ 16 = 0 R 1 1 2 2 🡪 122~16~ 12 0 🡪 C0~16~ 590~10~ 590 ÷ 16 = 36 R 14 48879~10~ **Decimal to Hexadecimal Conversion Practice** 290~10~ 290 ÷ 16 = 18 R 2 192~10~ 192 ÷ 16 = 12 R 0 18 ÷ 16 = 1 R 2 12 ÷ 16 = 0 R 12 1 ÷ 16 = 0 R 1 1 2 2 🡪 122~16~ 12 0 🡪 C0~16~ 590~10~ 590 ÷ 16 = 36 R 14 48879~10~ 48879 ÷ 16 = 3054 R 15 36 ÷ 16 = 2 R 4 3054 ÷ 16 = 190 R 14 2 ÷ 16 = 0 R 2 190 ÷ 16 = 11 R 14 11 ÷ 16 = 0 R 11 2 4 14 🡪 24E~16~ 11 14 14 15 🡪 BEEF~16~ **Decimal to Hexadecimal Conversion Practice** 290~10~ 290 ÷ 16 = 18 R 2 192~10~ 192 ÷ 16 = 12 R 0 18 ÷ 16 = 1 R 2 12 ÷ 16 = 0 R 12 1 ÷ 16 = 0 R 1 1 2 2 🡪 122~16~ 12 0 🡪 C0~16~ 590~10~ 590 ÷ 16 = 36 R 14 48879~10~ 48879 ÷ 16 = 3054 R 15 36 ÷ 16 = 2 R 4 3054 ÷ 16 = 190 R 14 2 ÷ 16 = 0 R 2 190 ÷ 16 = 11 R 14 11 ÷ 16 = 0 R 11 2 4 14 🡪 24E~16~ 11 14 14 15 🡪 BEEF~16~ Why do we have hexadecimal representations? ∙ Hexadecimal representation is used for several practical reasons. Why do we have hexadecimal representations? ∙ Hexadecimal representation is used for several practical reasons. ∙ It serves as an alternative way to represent and manipulate binary data, offering advantages over binary and decimal representations in various scenarios. Why do we have hexadecimal representations? ∙ Hexadecimal representation is used for several practical reasons. ∙ It serves as an alternative way to represent and manipulate binary data, offering advantages over binary and decimal representations in various scenarios. Here\'s why hexadecimal representation is valuable: Compact Representation Why do we have hexadecimal representations? ∙ Hexadecimal representation is used for several practical reasons. ∙ It serves as an alternative way to represent and manipulate binary data, offering advantages over binary and decimal representations in various scenarios. Here\'s why hexadecimal representation is valuable: Compact Representation ∙ Hexadecimal (base-16) representation allows for more compact representations of binary data. Why do we have hexadecimal representations? ∙ Hexadecimal representation is used for several practical reasons. ∙ It serves as an alternative way to represent and manipulate binary data, offering advantages over binary and decimal representations in various scenarios. Here\'s why hexadecimal representation is valuable: Compact Representation ∙ Hexadecimal (base-16) representation allows for more compact representations of binary data. ∙ Each hexadecimal digit corresponds to a group of four binary digits (bits). Why do we have hexadecimal representations? ∙ Hexadecimal representation is used for several practical reasons. ∙ It serves as an alternative way to represent and manipulate binary data, offering advantages over binary and decimal representations in various scenarios. Here\'s why hexadecimal representation is valuable: Compact Representation ∙ Hexadecimal (base-16) representation allows for more compact representations of binary data. ∙ Each hexadecimal digit corresponds to a group of four binary digits (bits). ∙ This compactness is particularly useful when dealing with large binary numbers or memory addresses, making it easier to read and write compared to long strings of 0s and 1s. Why do we have hexadecimal representations? ∙ Hexadecimal representation is used for several practical reasons. ∙ It serves as an alternative way to represent and manipulate binary data, offering advantages over binary and decimal representations in various scenarios. Here\'s why hexadecimal representation is valuable: Compact Representation ∙ Hexadecimal (base-16) representation allows for more compact representations of binary data. ∙ Each hexadecimal digit corresponds to a group of four binary digits (bits). ∙ This compactness is particularly useful when dealing with large binary numbers or memory addresses, making it easier to read and write compared to long strings of 0s and 1s. ∙ For example, the binary number 1011 (which has the decimal representation of 11) has a hexadecimal representation of B. Alignment with Memory Addressing ∙ In computer memory, data is often stored in bytes (groups of 8 bits). Alignment with Memory Addressing ∙ In computer memory, data is often stored in bytes (groups of 8 bits). ∙ Since two hexadecimal digits can represent a full byte (256 possible values), hexadecimal is commonly used to display memory addresses and byte offsets in debugging and programming contexts. Alignment with Memory Addressing ∙ In computer memory, data is often stored in bytes (groups of 8 bits). ∙ Since two hexadecimal digits can represent a full byte (256 possible values), hexadecimal is commonly used to display memory addresses and byte offsets in debugging and programming contexts. Representation of Data Patterns ∙ Hexadecimal is useful for representing bit patterns, especially in fields such as computer graphics and digital design. Alignment with Memory Addressing ∙ In computer memory, data is often stored in bytes (groups of 8 bits). ∙ Since two hexadecimal digits can represent a full byte (256 possible values), hexadecimal is commonly used to display memory addresses and byte offsets in debugging and programming contexts. Representation of Data Patterns ∙ Hexadecimal is useful for representing bit patterns, especially in fields such as computer graphics and digital design. ∙ It\'s easier to visualize and work with bit patterns using hexadecimal notation than binary. Representation of Colors ∙ In computer graphics, colors are often represented in hexadecimal format. Representation of Colors ∙ In computer graphics, colors are often represented in hexadecimal format. ∙ Each component of a color (red, green, blue) is typically represented by two hexadecimal digits, allowing for a wide range of colors to be represented. Representation of Colors ∙ In computer graphics, colors are often represented in hexadecimal format. ∙ Each component of a color (red, green, blue) is typically represented by two hexadecimal digits, allowing for a wide range of colors to be represented. System Programming ∙ Hexadecimal representation is commonly used in system-level programming, such as configuring hardware devices or working with low-level data structures like registers.