Unit 1
Digital Information
Select a topic to expand it.
1.1Bits and Digital Information
Information can be sent using all kinds of real-world phenomena — light, electricity, radio waves, sound. No matter which one is used, a computing device represents that information the same way: as a pattern of two possibilities.
00101010 ABAABAA on-off-on-off
All three represent the same idea. What matters isn't what the two options are, it's that there are exactly two.
A bit (short for binary digit) is a single unit of information, written as a 0 or a 1. A byte is 8 bits.
Ultimately, a computer represents all data as bits.
Why two options?
A system with two clearly different states is easy to build and hard to misread. A light is on or off; a wire has voltage or it doesn't. Adding more states means more chances to confuse one for another.
All number systems work alike
When you invent a number system from scratch — say, one built only from circles and squares — you end up needing the same things every number system needs:
- Unique symbols to build numbers from
- A pattern for combining them
- A rule for adding a place value when you run out of patterns
- The ability to count to any number
Decimal has ten symbols (0–9). Binary has two (0, 1). Otherwise they follow the same rules — which is exactly why binary isn't as strange as it first looks.
1.2Binary Numbers
Binary represents information using only two options. Decimal — the system you already use — represents it using ten.
A flippy-do converts between them. Each place value is a power of two:
| Place | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Bit | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
Add up the places with a 1: 128 + 16 + 8 + 2 = 154.
How many numbers can you represent?
Every bit you add doubles the possibilities.
With 5 bits you can represent 32 possibilities. With 6 bits, 64.
Number of possibilities = 2^(number of bits)
With 4 bits: 2^4 = 16 possibilities.
What's the highest number you can count to?
The possibilities include zero, so the largest value is one less than the amount of possibilities.
Highest number = 2^(number of bits) − 1
With 4 bits: 2^4 − 1 = 15.
An 8-bit flippy-do can represent 256 different numbers and count as high as 255.
A flippy-do is limited by its size, but binary itself isn't. Any number can be represented in binary as long as you have enough bits.
Quick reference
| Bits | Possibilities | Highest number |
|---|---|---|
| 1 | 2 | 1 |
| 2 | 4 | 3 |
| 3 | 8 | 7 |
| 4 | 16 | 15 |
| 5 | 32 | 31 |
| 6 | 64 | 63 |
| 7 | 128 | 127 |
| 8 | 256 | 255 |
1.3Abstraction
Abstraction is a simplified representation of something complex — the complexity is taken out of focus so you can work with the idea without tracking every detail underneath.
You use abstractions constantly without noticing. A car's steering wheel is an abstraction: you turn it to go left without thinking about the linkage, the tires, or the road surface.
Abstraction in representing data
Every time we represent something with a simpler stand-in, that's abstraction:
- Using numbers to represent text instead of writing out the actual binary
- Representing a black and white image as a grid of
0s and1s - Representing a color image as numbers for red, green, and blue
In each case the real thing — a letter, a photograph — is complicated. The representation is not. That's the point.
Representing text
Text can be represented in binary the same way numbers are. Each character gets assigned a number, and that number is stored in binary.
Working in numbers rather than raw binary keeps the task manageable while you learn it — and that shortcut is itself an abstraction.
Layers of abstraction stack. Binary represents a number, the number represents a character, the characters represent a sentence. Each layer hides the one below it.
1.4Sampling, Analog Data, and Digital Data
Analog data is non-digital data — data whose values change continuously, or smoothly, over time. A painting, the hands of a clock, and acoustic music are all analog.
Digital data changes discretely, through a finite set of possible values.
Sampling is the process of creating a digital representation of analog data by measuring the analog data at regular intervals. Each measurement is called a sample.
Sampling is what turns analog into digital. Analog data is the smooth original; the samples are the digital copy.
More samples, more detail
When we sampled the swan image, the second pass used more samples than the first — and the result was noticeably better.
| More sampling | Less sampling |
|---|---|
| Better quality | Lower quality |
| More detail | Less detail |
| More bits | Fewer bits |
That trade-off never goes away. Higher quality always costs more bits, and fewer bits always cost quality.
Black and white images
A black and white image can be sampled into a grid of pixels, with one bit per pixel:
0= black1= white
One bit per pixel gives exactly two options, so the image can only be pure black and pure white — no grey.
Color images
Color works the same way, with more bits per pixel.
The more bits per pixel you use, the more colors you can represent.
With enough bits per pixel you can describe how much red, green, and blue each pixel contains, which is how full-color images are stored.
1.5Overflow Errors and Round-off Errors
No system or device can store an infinite amount of information. Every computing system has a limited, fixed number of bits available to represent a value — and that limit is where both of these errors come from.
Overflow error — an error from attempting to represent a number that is too large for the system.
Round-off error — an error from attempting to represent a number that is too precise for the system. The number gets rounded instead.
Overflow
A binary odometer makes this visible: once every place value is filled, there's nowhere for the next count to go, and the number rolls over.
With 3 bits you can represent 8 values (0 through 7). The moment you try to represent 8, you've run out of bits.
Example question: If your system only has 3 bits, what is the smallest number for which an overflow error would occur?
Answer: 8
The answer to a question in this shape is always the first number that overflows given the number of bits in the system — which is the same as the total number of possibilities.
| Bits | Represents | Smallest number that overflows |
|---|---|---|
| 3 | 0–7 | 8 |
| 4 | 0–15 | 16 |
| 8 | 0–255 | 256 |
Round-off
Round-off is about precision, not size. Some values — like 1/3, or many decimals — would need more bits than the system has to be written exactly, so the system stores the closest value it can and drops the rest.
Test tip: if you see the word "precise" or "imprecise" in a question, you are dealing with a round-off error question.
Telling them apart
| The number is… | Error |
|---|---|
| too large | overflow |
| too precise | round-off |
1.6Compression
Compression reduces the number of bits needed to represent something. There are two kinds, and the difference between them is whether you can get the original back.
Lossless compression
Lossless compression reduces the number of bits needed to represent something without losing any information. The process is reversible — the original can be restored exactly.
The "Pitter, Patter" poem shows the idea: repeated pieces of text are replaced with shorter symbols, and a key records what each symbol stands for. Fewer characters, so fewer bits — and because the key is kept, nothing is lost.
Lossless compression is ideal when quality is the priority.
Lossy compression
Lossy compression reduces the number of bits needed to represent something in which some information is lost or thrown away. The process is not reversible.
Removing some characters from text may not hurt readability — you can often still read a sentence with letters missing, because you fill in the gaps yourself. But push it far enough and the loss of detail changes the meaning entirely.
Because lossy algorithms actually discard detail, they can shrink a file far more than lossless can.
Lossy compression is ideal when reducing file size matters more than quality.
Comparing the two
| Lossless | Lossy | |
|---|---|---|
| Information lost | None | Some |
| Reversible | Yes | No |
| Size reduction | Smaller | Much greater |
| Best when | Quality matters | File size matters |
1.7Copyright & Creative Commons
Intellectual property is a work or invention that results from creativity — a piece of writing, a design, a song, a program. It is a non-tangible asset owned by a person or a company, and the owner has rights to it.
Copyright is the exclusive legal right, given to a creator or an assignee, to print, publish, perform, film, or record literary, artistic, or musical material — and to authorize others to do the same.
Copyright is the legal protection for the owners of intellectual property. Copyright owners decide how their intellectual property may be used.
Creative Commons
Not every creator wants to lock their work down. Creative Commons is a collection of public copyright licenses that enable the free distribution of an otherwise copyrighted work.
A creator uses a Creative Commons license when they want to give people the right to share, use, and build upon work they created.
The key point: this is still the copyright owner's choice. Placing work in the Creative Commons isn't giving up copyright — it's the owner using their copyright to grant permissions in advance, on terms they select.
Why it matters
Almost everything you'd want to use in a project — an image, a sound, a block of code — belongs to someone. Creative Commons is how you find material you're actually allowed to use, and how you'd share your own work if you wanted others to build on it.
VocabularyUnit 1 Vocab
Binary — A way of representing information using only two options.
Decimal — A way of representing information using only ten options.
Bit — A contraction of "Binary Digit"; a single unit of information in a computer, typically represented as a 0 or 1.
Byte — 8 bits.
Overflow Error — Error from attempting to represent a number that is too large. This occurs because there is a fixed number of bits for any computing system.
Round-off Error — Error from attempting to represent a number that is too precise. This occurs because there is a fixed number of bits for any computing system.
Analog Data — Non-digital data. Data with values that change continuously, or smoothly, over time. Examples of analog data include a painting, a clock, or acoustic music.
Digital Data — Data that changes discretely, through a finite set of possible values.
Sampling — A process for creating a digital representation of analog data by measuring the analog data at regular intervals called samples.
Lossless Compression — A process for reducing the number of bits needed to represent something without losing any information. This process is reversible.
Lossy Compression — A process for reducing the number of bits needed to represent something in which some information is lost or thrown away. This process is not reversible.
Intellectual Property — A work or invention that is the result of creativity, such as a piece of writing or a design, to which one has rights and for which one may apply for a patent, copyright, trademark, etc.
Copyright — The exclusive legal right, given to a creator or an assignee, to print, publish, perform, film, or record literary, artistic, or musical material, and to authorize others to do the same.
Creative Commons — A collection of public copyright licenses that enable the free distribution of an otherwise copyrighted work, used when an author wants to give people the right to share, use, and build upon a work that they have created.
Abstraction — A simplified representation of something that is complex; the complexity is taken out of focus.
Computing Innovation — A new type or version of computer hardware or software. Instagram was a computing innovation in social media software; the iPhone was a computing innovation in smartphone hardware.