What Is Reinforcement Learning?
How machines learn from rewards and mistakes — the same way you learned to ride a bike, play a game, or find your way around.
🎯 By the end you'll understand
Where Reinforcement Learning sits among the three branches of Machine Learning, the one thing that makes it different (learning by trial and error from rewards), and the core pieces — agent, environment, state, action, reward — that every RL system is built from.
KEY INSIGHTThe one idea to take away
Reinforcement Learning is learning by doing: an agent tries things, gets rewarded or punished, and slowly figures out how to earn the most reward.
No one hands the agent the right answers. It learns the way you and I learn most things in real life — by interacting with the world, seeing what happens, and adjusting. That single idea is the whole field in one sentence.
Supervised learning is taught with answers. Unsupervised learning finds patterns with no answers. Reinforcement learning gets no answers — only rewards, and has to discover good behaviour for itself. That's what makes it special.
CONTEXTThree kinds of learning
Have you heard of Artificial Intelligence and Machine Learning? If so, you're on the right track. Machine Learning has three major subfields, and the easiest way to feel the difference is with a quick analogy for each.
Supervised Learning is like teaching a friend to solve math problems by giving them practice problems with the correct answers. Over time they get better by learning from your examples. A program works the same way: show it lots of data labelled with the right answers — say, images marked "real" or "fake" money — and it learns to make predictions on new examples it has never seen.
Unsupervised Learning has no labels and no right answers. Imagine being handed a pile of puzzle pieces with no picture to guide you — you'd figure out how they fit just by spotting patterns. A program does the same: given a heap of customer data, it might group people with similar buying habits together, uncovering hidden structure no one told it about.
Reinforcement Learning learns completely differently from the first two. Instead of answers, you let the model make decisions in an environment and reward or punish it based on how well it does. Over time it tries to make better and better choices to maximise its reward.
| Branch | What it's given | How it learns | Analogy |
|---|---|---|---|
| Supervised | data + correct answers | copy the labelled examples | studying with an answer key |
| Unsupervised | data, no answers | find patterns & groups | solving a puzzle with no picture |
| Reinforcement | a reward signal | trial and error | learning to ride a bike |
CORE CONCEPTWhat makes RL different
The main idea behind Reinforcement Learning is that an agent (an AI model) learns by taking actions and interacting with its environment, receiving rewards as feedback for those actions. This is remarkably close to how we humans learn — from our experiences.
There's no teacher saying "the correct move was X." There's only the world reacting, and a number — the reward — telling the agent whether things went well or badly. Good outcomes nudge the agent to repeat what it did; bad outcomes push it to do something else next time. Repeat that loop thousands of times and skilled behaviour emerges.
If a system learns from labelled answers, it's supervised. If it just finds structure, it's unsupervised. If it learns from the consequences of its own actions, it's reinforcement learning.
INTUITIONTeaching your sister to ride a bike
Let's make it concrete. Imagine you're teaching your little sister to ride a bike — she's never done it before. You give her the bike and let her figure it out herself. She interacts with the bike and her surroundings by pedaling and steering — those are her actions.
To encourage her, you give her a reward — a banana 🍌 — every time she rides a metre without losing balance. Each smooth metre earns +1, motivating her to keep going, with a clear goal: collect as many bananas as possible by riding well.
But if she loses her balance and falls, she gets −1. That negative feedback discourages whatever she just did. No one tells her how to ride — she discovers it through trial and error, adjusting her actions to earn bananas and avoid falls.
In RL terms: your sister is the agent, the bike and surroundings are the environment, and her choices — pedaling, steering — are the actions. The bananas and falls form the reward function, which guides the agent toward her goal: riding smoothly and collecting as many bananas as possible. Without any direct supervision, she gradually improves through interaction and feedback — exactly how humans and animals learn.
SEE ITThe reward signal in action
Now take your sister's place. The bike has three moves, and nobody tells you what they do or which one is right. Pick a move, read the reward, and reach the finish with as many bananas as you can. Then ride again.
Notice what happened: nobody told you which move was right. The +1 and −1 rewards alone shaped what you did next. Ride twice and the second total is usually higher: the road did not change, what you knew did. Your aim was never a single banana but the biggest total. That total is the heart of RL, and it has a name: the return.
What you ended up with, pedal steadily on the straight road and slow down and lean in the turn, is a rule from situation to move. RL calls that rule a policy, and it is the last item in the list below.
FRAMEWORKThe elements of an RL system
Everything in the bike story maps onto the standard pieces of every RL system. You'll meet each in depth across this course — here's the cast:
Agent
The learner and decision-maker — your sister. (The thing we're training.)
Environment
Everything the agent interacts with — the bike, the road, gravity.
State St
A snapshot of the situation right now — speed, balance, what's ahead.
Action At
A choice the agent makes — pedal, steer, brake.
Reward Rt+1
The feedback number after an action — +1 banana, −1 fall.
Policy π(a|s)
The agent's strategy: which action to take in each state. (Lesson 2.2)
The loop is always the same rhythm: the agent observes the state, picks an action, the environment returns a reward and a new state, and around it goes. We'll formalise that loop in Lesson 1.2.
FORMALA formal definition
Now that you have the picture, here's the precise version.
A framework for solving control tasks (decision problems) by building agents that learn from their environment. The agents interact through trial and error and receive rewards — positive or negative — as feedback to guide their learning.
RL is about decision-making: discovering the actions that maximise reward in a given environment. Unlike supervised or unsupervised learning, where data is handed to you, RL generates its own data through trial and error, then adjusts behaviour based on whether each action turned out beneficial, neutral, or harmful. That makes it the natural fit for systems that must make many small decisions on their own — robots, game-players, controllers — without a human in the loop.
This whole setup has a formal name you'll meet soon: a Markov Decision Process (MDP). For now, just hold the picture: an agent, an environment, actions, and a reward signal it's trying to maximise.
WEAKNESSCommon mistakes to avoid
No — there's no correct answer per step. The agent only gets a reward after acting, often delayed, and must figure out which earlier actions deserve the credit. That "credit assignment" problem doesn't exist in supervised learning.
The goal is the biggest total reward over time (the return), not the next +1. Sometimes the best move scores nothing now but sets up a big payoff later (Lesson 1.3).
A badly-shaped reward makes an agent learn the wrong thing brilliantly well (we'll meet "reward hacking" later). The reward function is your steering wheel — design it carefully.
KEY INSIGHTWhere this connects in your course
- The RL loop (1.2) — we formalise the state → action → reward → next-state cycle you just saw.
- The agent's goal (1.3) — the "return", and why future rewards get discounted by γ.
- Markov Decision Processes (1.4) — the formal frame behind the whole thing.
- How the agent learns (Stage 2) — policy, value functions, and the algorithms (Q-learning, SARSA) that actually do the learning.
Hold the one sentence — learn by trial and error to maximise reward — and everything ahead is just making that precise and making it work.
GLOSSARYKey terms introduced
- Reinforcement Learning
- Learning to make decisions by trial and error from a reward signal.
- Agent
- The learner/decision-maker being trained.
- Environment
- Everything outside the agent that it senses and affects.
- State (St)
- A snapshot of the situation the agent observes.
- Action (At)
- A choice the agent makes to affect the environment.
- Reward (Rt+1)
- Numeric feedback after an action — the only teaching signal.
- Reward function
- The rule that assigns rewards to outcomes.
- Return
- The total (cumulative) reward over time — what the agent maximises.
- Policy (π)
- The agent's strategy: which action to take in each state.
ACTIVE RECALLCheck your understanding
Answer in your own words first, then reveal.
1In one sentence, what makes RL different from supervised and unsupervised learning?›
RL learns from the consequences of its own actions (a reward signal) through trial and error — not from labelled answers (supervised) or from finding patterns with no answers (unsupervised).
2Map the bike story onto RL terms: who/what is the agent, environment, action, and reward?›
Agent = your sister; environment = the bike + road; actions = pedaling/steering; reward = +1 banana per smooth metre, −1 for falling. The rewards together are the reward function.
3Why shouldn't the agent just chase the biggest immediate reward?›
Because the goal is the biggest return (total reward over time), not the next point. A move worth nothing now can set up much larger rewards later — so the agent must think long-term.
4The agent never gets told the correct action. So how does it improve?›
From the reward signal: outcomes that earned reward make those actions more likely to be repeated; outcomes that were punished make them less likely. Over many trials, good behaviour emerges from feedback alone.