Understanding Binary
Binary Representation
A binary number is a number expressed in Ones (1) and Zeros (0).
How computer see information
Computers see information in binary.
Number System
A writing system for expressing numbers.
Decimal Notation
Decimal is a notation in which we have learned most of the mathematics. The unique digits used to represent numbers in decimal notation are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
The decimal notation for 4175 is
4 x 103 + 1 x 102 + 7 x 101 + 5 x 100 = 4175
The decimal notation has a base of 10 which means the number of unique symbols or digits used to represent numbers in that notation is 10.
Binary Notation
The only notation that computers understand is Binary Notation. The unique digits used to represent numbers in that notation are 0, 1. It has base 2.
11012 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = 8 + 4 + 1 = 1310
Decimal to Binary Conversion
Binary Representation for Different Files
All types of content (text, images, videos, and everything) must be converted to binary so that it can be stored by the computer. Different types of content occupy different amounts of space in the computer because they are represented by different lengths of Binary numbers.
Storing Integers in 4 Bits
16 different types of information can be represented in 4 - bit. The numbers can be represented from 0 to 15.
n-Bit Binary Number
- 2n distinct combinations are possible.
- Can represent numbers from 0 to 2n- 1.
if n = 8, the numbers can be represented from 0 to 255 (28 - 1).
Negative Numbers Representation
- Different representations and conventions are developed to store different types of information.
One bit is represented for the sign, and the remaining bits represent numbers. If the bit contains zero, it represents a positive value, and if it has one, it represents a negative number.
Representing Images
Image is made up of pixels. Pixel is the smallest unit in the picture. Each pixel has a specific colour.
Representing Colors
The colours are represented using different models. The basic one used in a lot of computers is the RGB or red, green, and blue model.
Based on the intensity of RGB, colours are represented as a number. Now, this number is represented as binary in computers.
Representing Text
Each character is encoded as an integer which is represented by a binary value.
ASCII
American Standard Code for Information Interchange(ASCII) represents the English alphabet, digits, and punctuation marks and requires only one byte to store a character. It means it represents 256 different things. There is a limit on no. of characters that can be represented.
UNICODE
Unicode allows us to represent characters using more than 1 byte.
UTF - 8
UTF-8 (Unicode Transformation Format - 8) is capable of storing 1,112,064 different characters and it has the same values for ASCII characters.
How Computer Gets Zero's and One's
Imagine we have a light bulb and a switch that turns the state of the light on or off. If we turn the light on, we can denote that the state is one. If the light bulb is off, we can represent the state is zero. In a similar way, the computer gets zero's and one's.