knowledge/science/math/Hexadecimal System.md
2023-12-04 11:02:23 +01:00

30 lines
No EOL
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
obj: concept
---
# Hexadecimal System
The hexadecimal numbering system, often referred to as "hex," is a base-16 numeral system widely used in computing and digital electronics. It provides a convenient way to represent binary-coded values with a more human-friendly and compact notation. In the hexadecimal system, numbers are represented using 16 different digits: 0-9 and A-F, where A stands for 10, B for 11, and so on up to F for 15.
## Representation
In hexadecimal, each digit represents a power of 16. The rightmost digit represents $16^0$ (1), the next digit to the left represents $16^1$ (16), the next $16^2$ (256), and so forth. For example:
- **1F in hexadecimal** is equal to $1×16^1+15×16^0$, which is 31 in decimal.
- **2A3 in hexadecimal** is equal to $2×16^2+10×16^1+3×16^0,$, which is 675 in decimal.
## Hexadecimal Digits
The hexadecimal system uses the following digits:
- **0, 1, 2, 3, 4, 5, 6, 7, 8, 9**: Represent values 0 to 9.
- **A, B, C, D, E, F**: Represent values 10 to 15.
## Uses in Computing
### Memory Addresses
In computer programming, memory addresses are often expressed in hexadecimal. Each byte of memory can be represented by two hexadecimal digits, providing a concise way to denote memory locations.
`Example: 0x1A3F`
### Color Representation
Hexadecimal is commonly used to represent colors in web development and digital graphics. In this context, a hexadecimal color code consists of three pairs of digits representing the intensities of red, green, and blue.
`Example: #FFA500 (RGB: 255, 165, 0)`
### Binary Representation
Hexadecimal is closely related to [binary](Binary%20System.md) representation. Each hexadecimal digit corresponds to four bits in binary. This relationship makes it easier to convert between hexadecimal and binary.
`Example: Binary 1010 is equivalent to Hex A.`