AP® Computer Science Principles · Big Idea 2 · Topic 2.1
Bits, Bytes, and Representing Everything Digitally
A bit is one on/off switch, the smallest unit of information. Group bits together and their combinations can stand for numbers, letters, or colors — which is how all digital data, from texts to photos, reduces to nothing but zeros and ones.
A computer is built from switches that are either on or off. Nothing in between. One switch, two possible states, is exactly what a bit is: the smallest unit of information, just enough to tell two things apart. On its own a single bit is not very useful — it can only mean yes or no, true or false, 0 or 1. The power comes from grouping bits. Line up eight of them and you get a byte, and now you are not choosing between 2 things but between 256, because each extra bit doubles how many combinations exist.
That doubling is the whole trick. One bit gives 2 values, two bits give 4, three give 8, four give 16. In general n bits give 2n distinct values, since every new switch can be paired with on or off against every combination that already existed. A byte, with its 256 combinations, is enough to assign a unique pattern to every letter, digit, and punctuation mark in a text encoding, or to represent 256 shades of gray in a black-and-white photo. The pattern itself carries no built-in meaning — 01000001 is just eight switches set a certain way. Software agrees on a scheme ahead of time, so that same pattern is read as the number 65, or the letter A, or a particular shade, depending on context.
This is the foundation under everything else in representing data digitally. Colors mix bytes for red, green, and blue; sound samples amplitude many times a second into bits; images arrange pixels, each one a number, into a grid. All of it traces back to switches that are only ever on or off, counted in groups to represent something a person recognizes.
Key terms
- bit
- The smallest unit of digital information, distinguishing exactly two states, usually written 0 or 1.
- byte
- A group of eight bits, capable of representing 28 = 256 distinct values.
- binary
- A number system using only two digits, 0 and 1, matching the two states a switch can hold.
- encoding
- An agreed-upon scheme for what a particular pattern of bits is meant to represent, such as a letter or color.
Watch it explained
- How it worksHow do eight bits grouped into a byte become a number, a letter, or a shade of gray?
- How it worksWalk me through how one physical switch being on or off carries exactly one bit of information.
- Worked exampleFind how many different values 4 bits can represent, and list every one of them.
- Going furtherWhat happens to the count of possible values each time you add one more bit?
Check yourself
End of topic.