Introduction to Reinforcement Learning
- Formal meaning of reinforcement learning and the agent–environment view.
- Difference between reinforcement learning, supervised learning, and unsupervised learning (instructive vs. evaluative feedback).
- Core elements of reinforcement learning: policy, reward signal, value function, and model.
- Typical application areas where sequential decisions and delayed consequences matter.
- Review of key terms required for reading Chapter 1 of Sutton and Barto.
- Tic-tac-toe as a toy example for value-based learning and temporal-difference updating.
- Review questions for examination preparation.
What is Reinforcement Learning?
This is, arguably, the most natural form of learning: it is how humans, animals, and even infants learn. A baby is not given labelled examples of “how to walk”; it tries, falls, gets feedback (pain, support from a parent, balance restored), and gradually improves.
At discrete time step , the agent observes a state and selects an action . The environment then produces a scalar reward and transitions to a new state . The elementary interaction pattern is:
The objective is to learn a way of acting (a policy) that maximizes cumulative reward over time, not only the next immediate reward. Hence, reinforcement learning is not merely prediction: it is about choosing actions that actively influence future situations and future rewards.
1.1 The Three Paradigms of Learning
To appreciate RL, contrast it with the two paradigms you may already know:
| Learning Type | Learning Signal | Main Nature of the Problem | Primary Objective |
|---|---|---|---|
| Supervised Learning | Labelled examples provided by an external teacher: . Each example includes an input and the desired output. | Feedback is instructive (tells explicitly what the correct output should be). The learner generalizes from known examples to unseen data. | Learn mapping ; minimize classification error / MSE. |
| Unsupervised Learning | No reward signal and no labelled target targets provided. Unlabelled data . | Feedback is absent / implicit. The learner attempts to discover hidden structure in data, such as clusters, associations, or useful representations. | Discover latent patterns, clusters, and low-dimensional representations. |
| Reinforcement Learning | A scalar numerical reward is received as a consequence of actions taken. Trajectories . | Feedback is evaluative (evaluates how good the action was, but does not specify the best possible action). The learner must interact, try actions, and assign credit over time. | Learn a policy that maximizes long-run expected cumulative reward. |
In supervised learning, examples of correct behaviour are supplied by an external supervisor. In reinforcement learning, such examples are usually not available. The agent may know that an outcome was good or bad, but it may not know which action should have been chosen instead. This creates the primary need for exploration and credit assignment.
Sutton & Barto identify three characteristics as the most important distinguishing features of reinforcement learning problems:
- Closed-loop in an essential way: The learning system's actions influence its later inputs. This creates a feedback cycle that does not exist in supervised learning, where predictions do not affect future training examples.
- No direct instructions: The agent is not told which actions to take. Unlike supervised learning, there are no labelled examples of correct behaviour. The agent must discover which actions yield the most reward by trying them out (trial-and-error search).
- Consequences play out over extended time periods (Delayed reward): Actions may affect not only the immediate reward but also the next situation, and through that, all subsequent rewards. In the most interesting and challenging cases, these effects unfold over many steps.
1.2 Why "Deep" Reinforcement Learning?
Classical RL is built on tables and tabular updates (we will see exactly this in the tic-tac-toe example). But for problems with huge state spaces (Atari frames, robotic joint configurations, Go boards), we cannot store one entry per state.
Deep Reinforcement Learning replaces those tables with deep neural networks that approximate value functions and/or policies. The foundations, however, remain the same as classical RL—so we will spend a lot of time on the classical ideas before bringing in deep learning.
The Agent–Environment Interface
The two fundamental entities in RL are the agent and the environment.
1.3 The Interaction Loop
At every discrete time step the following loop runs:
- The agent observes the current state .
- The agent picks an action .
- The environment transitions to a new state and emits a scalar reward .
- The agent uses to update its internal knowledge and choose the next action.
This loop is the heart of all RL. Every algorithm we study—tabular methods, Q-learning, policy gradients, deep RL—fits inside this loop.
1.4 The Core Elements of Reinforcement Learning
| Element | Meaning and Role |
|---|---|
| Agent | The learner and decision-maker. It senses the environment, selects actions, and improves its behaviour through experience. |
| Environment | Everything outside the agent that responds to actions and returns next states and rewards. |
| Policy () | The agent’s behaviour rule mapping perceived states to actions. A deterministic policy gives one action; a stochastic policy gives action probabilities. |
| Reward Signal () | The immediate scalar feedback from the environment defining what is good or bad. It is the primary basis for changing policy. |
| Value Function ( / ) | An estimate of long-term desirability. It specifies how good a state (or state-action pair) is by considering expected cumulative future reward. |
| Model (Optional) | A predictive description of the environment. Given a state and action, it predicts the next state and reward to support planning. |
- Agent – the entity that learns.
- Environment – everything outside the agent.
- State – a description of the current situation. Could be a chess board, a sensor reading, an image.
- Action – what the agent does at time . May be discrete (left/right/up/down) or continuous (steering angle in ).
- Reward – a single scalar number returned by the environment after the agent acts.
1.5 The Fourth Sub-Element: Model of the Environment
Beyond the agent and the environment, Sutton & Barto identify four main sub-elements in a reinforcement learning system:
- Policy: Defines the learning agent's way of behaving at a given time — a mapping from perceived states to actions. It corresponds to what psychology would call a set of stimulus–response rules or associations. The policy alone is sufficient to determine behaviour; it is the core of an RL agent. In general, policies may be stochastic.
- Reward signal: Defines the goal of the RL problem. On each time step, the environment sends a single number to the agent. The agent's sole objective is to maximize the total reward it receives over the long run. The reward signal is the primary basis for altering the policy. Reward signals may be stochastic functions of the environment state and the actions taken.
- Value function: Specifies what is good in the long run. The value of a state is the total amount of reward an agent can expect to accumulate over the future, starting from that state. Whereas rewards are primary (given directly by the environment), values are secondary (estimated and re-estimated from sequences of observations). The most important component of almost all RL algorithms is a method for efficiently estimating values.
- Model of the environment (optional): Something that mimics the behaviour of the environment, allowing inferences about how the environment will behave. Given a state and action, a model might predict the resultant next state and next reward.
The presence or absence of a model leads to a fundamental taxonomy:
| Approach | Description |
|---|---|
| Model-Based Methods | Use a model of the environment for planning and prediction. The agent can simulate “what-if” scenarios before taking real actions. Examples: Dynamic Programming, AlphaGo (MCTS + learned model). |
| Model-Free Methods | Learn directly from experience (trial and error) without explicitly modelling environment dynamics. The agent does not predict how states transition—it just learns which actions produce reward. Examples: Q-learning, Policy Gradients, TD learning. |
The tic-tac-toe player in this lecture is model-free with respect to its opponent: it has no model predicting what the opponent will do. Modern RL spans the whole spectrum—the most powerful systems often combine both approaches. AlphaGo Zero, for instance, learns a value function via self-play (model-free) and uses Monte Carlo Tree Search for planning at decision time (model-based).
1.6 When to Use Reinforcement Learning
RL is well-suited to problems in large environments when any of these hold:
- A model of the environment is known, but an analytic solution is not available (e.g., the equations exist but are intractable).
- Only a simulation model of the environment is given (simulation-based optimisation).
- The only way to collect information about the environment is to interact with it—no offline dataset of correct actions exists.
1.7 Examples of Agent-Environment Pairs
- Chess: Agent = the player. Environment = the board + the opponent. Action = a legal move. Reward = on win, on loss, on draw, all emitted only at the end of the game (a strongly delayed reward).
- Autonomous driving: Agent = the driving controller. Environment = road, other vehicles, passengers, traffic. Reward = smooth motion (), passenger discomfort or collisions ().
- Industrial control (refinery): Agent = adaptive controller. Environment = the refinery with sensors and actuators. Reward = yield / cost / quality trade-off, measured continuously. The controller optimises without sticking to engineer-specified set points (Sutton & Barto).
- Robotics: Agent = the robot controller. Environment = the physical world including joint dynamics, friction, sensors. Reward = progress toward goal (e.g., distance covered), penalties for falling or high torque. RL excels in continuous control tasks like walking, grasping, and manipulation.
- Phil preparing breakfast (Sutton & Barto): A rich multi-level example. Phil navigates to the cupboard, selects cereal, fetches a bowl, pours milk—each sub-action driven by nested goals. Even a mundane everyday task involves a complex web of conditional behaviour and interlocking goal–subgoal relationships. Each step is guided by goals (grasping the spoon, getting to the refrigerator) in service of higher goals (having the spoon to eat with, obtaining nourishment).
- A gazelle calf: Minutes after birth, struggles to stand; half an hour later runs at 20 mph. This is nature’s reinforcement learning—trial-and-error interaction with gravity and muscle coordination, driven by reward signals of stability and locomotion.
- Vacuum cleaner robot: Agent = the robot. Environment = the house. Reward = for dust collected, for time and battery used.
- Stock trading: Agent = trading bot. Environment = market. Reward = profit / loss.
- New employee in a company: You take actions (do work, send emails). Reward = manager’s feedback. Often delayed: your manager may only comment on something you did two weeks ago.
Key Characteristics of Reinforcement Learning
RL differs from supervised learning in several important ways:
- Reward-based interaction: Learning is driven by a single scalar reward signal from the environment. The feedback is evaluative (how good was that action?) rather than instructive (here is the correct action). This is a fundamental distinction: in supervised learning, a teacher explicitly says “this is the right answer”; in RL, the environment only says “that got you +5” or “that got you −2”.
- Sequential decision making: The agent does not solve a one-shot prediction problem; it must choose a sequence of actions that interact with each other. The present action changes the next state, and the next state changes what actions are available later.
- Delayed consequences: A reward (positive or negative) may arrive long after the action that caused it. Think of setting a trap in chess: the payoff arrives many moves later. This creates the credit assignment problem—deciding which earlier actions contributed to later success or failure.
- Trial-and-error learning: The agent must try actions to discover their effects. There is no oracle telling it the “correct” action. The agent may know that an outcome was good, but it may not know which action should have been chosen instead.
- Exploration vs. exploitation: The agent must balance using what it already knows (exploit) with trying new things to discover better strategies (explore). We will return to this in Section 6. This dilemma does not even arise in the purest forms of supervised or unsupervised learning.
- Non-i.i.d. data: Successive states are highly correlated; the data distribution depends on the policy. This breaks many assumptions of supervised learning.
- Uncertainty: The agent normally operates with incomplete knowledge of the environment. Outcomes may be stochastic—the same action may not always lead to the same result. RL explicitly considers the whole problem of a goal-directed agent interacting with an uncertain environment.
Rewards, Returns, and Value Functions
1.8 From Reward to Return
Maximizing the immediate reward is not enough. The agent should maximize the cumulative reward—called the return—starting from time .
1.9 Policy: The Agent's Way of Working
Intuitively: the policy is “my way of working.” Given a situation, what do I do? Two different agents in the same state can choose different actions because they have different policies.
1.10 Value Function: Long-Term Desirability
- Reward = immediate, short-term feedback for one action.
- Value = long-term desirability of being in a state, assuming the agent follows policy from now on.
1.11 A Two-State Toy Example
Consider an environment with only two states and , and two actions: (left) and (right).
Suppose my policy in state always picks (i.e., I bump the wall). My trajectory from looks like:
The return from is small. But your policy might always choose from , giving:
which has a much higher return. Hence:
- Different policies different value functions.
- Therefore, values are always with respect to a particular policy.
1.12 The Policy-Value Duality
- Given a policy , we can evaluate it by computing .
- Given accurate values of all neighbouring states, we can improve our policy by simply choosing the action that leads to the highest-valued next state.
A Worked Example: Learning Tic-Tac-Toe with RL
We now apply RL to a concrete game. This example is adapted from Sutton & Barto, Chapter 1, and it illustrates almost every idea from the lecture.
1.13 Problem Setup
Two players (agent vs. opponent) alternate placing and on a grid. The agent plays . There are three possible outcomes:
- Agent wins reward .
- Agent loses reward (or ).
- Draw reward .
1.14 Why Not Just Use Exhaustive Search?
In the AI course you may study minimax search or alpha-beta pruning for games. These methods:
- Assume the opponent plays optimally.
- Search the entire game tree (or a heuristic-pruned version).
- Find the theoretically optimal move.
But what if the opponent is not optimal? A suboptimal opponent might have specific weaknesses we can exploit. RL learns to play against the opponent it actually faces, not an idealised optimal one.
RL is also scalable: exhaustive search is impossible for games like Go or StarCraft.
1.15 The Tabular Value Function
We maintain a table with one row per possible board state. Each row stores a single number representing the current estimate of the value of that state.
Initialization:
- For states where the agent has already won (three ’s in a line): set .
- For states where the opponent has won: set .
- For all other states: set (we are uncertain—roughly 50/50).
This is called a tabular method: each state is one row, and updating one row does not affect any other row. Tabular methods are simple and powerful when the state space is small enough to enumerate. (For tic-tac-toe there are only a few thousand legal states; for chess there are , so tables won't fit and we need deep learning.)
1.16 Choosing Moves: Greedy Action Selection
Suppose the opponent has just moved, giving the agent a board configuration . From , the agent has several possible moves leading to states .
The greedy (exploitation) move: look up in the table, and play the move that leads to the highest-valued state.
In the figure above: the opponent moved . The agent considers all moves from and chooses the one leading to a state with value (the highest among its options).
1.17 The Temporal-Difference (TD) Update Rule
After the agent makes a greedy move from state to a state (via the opponent and the agent’s greedy choice), it updates the value of to be closer to the value of :
| Case | Updated | Interpretation | |||
|---|---|---|---|---|---|
| Later state looks better | 0.50 | 0.70 | 0.10 | The earlier state becomes slightly more promising—value nudged upward. | |
| Later state looks worse | 0.60 | 0.30 | 0.10 | The earlier state’s value is reduced—we were too optimistic. | |
| Larger learning step | 0.40 | 0.80 | 0.25 | A larger moves the estimate faster but with less stability. | |
| Close estimates | 0.65 | 0.67 | 0.10 | Only a small correction is made when successive estimates are similar. |
Key insight: The update does not replace the old estimate fully. It moves it part of the way toward the later estimate. Small gives slow but stable learning. Larger gives faster but more sensitive (higher variance) learning. A decreasing step size can make the estimates settle for a fixed opponent; a step size that never vanishes lets the agent keep adapting if the opponent changes slowly.
1.18 Bootstrapping and Backing Up Values
Notice that we update using , which is itself only an estimate. This is called bootstrapping: we learn an estimate from another estimate.
Initially every internal state has value , so updates do little. But the values of terminal states ( for a win, for a loss) are correct from the start. As games are played, terminal values gradually propagate backward through the table: states adjacent to wins get value above , states adjacent to those get nudged up, and so on. Over many games, the entire table becomes informative.
Suppose, instead of playing against a fixed imperfect opponent, the reinforcement learning algorithm described above played against itself, with both sides learning at the same time. What do you think would happen? Would the agent learn a different policy for selecting moves? (Hint: consider what happens when both sides start from an initial value of 0.5 for all non-terminal states.)
Many tic-tac-toe positions appear different but are actually the same if you rotate or reflect the board. How could symmetries in the game be exploited to speed up learning? How might the value function be modified to take advantage of this? (This question previews the idea of feature construction and generalisation, which becomes central when we move to function approximation in later lectures.)
Suppose the reinforcement learning player was greedy — that is, it always picked the move that brought it to the position it rated as best, with no exploration at all. Would it learn to play better, or worse, than a non-greedy player? What problems might occur?
Suppose learning updates occurred after all moves, including exploratory moves. If the step-size parameter is appropriately reduced over time, the state values would converge to a set of probabilities. What are the two different sets of probabilities computed when we do, and when we do not, learn from exploratory moves? Assuming we continue making exploratory moves, which set of probabilities might be better to learn? Which would result in more wins?
Can you think of other ways to improve the reinforcement learning player? Can you think of any better way to solve the tic-tac-toe problem as posed?
Exploration vs. Exploitation
1.19 The Dilemma
A driver who only follows the GPS will never discover a faster shortcut. A driver who always experiments with random side streets is reckless and never reaches a destination. The skill is in the balance.
Sutton & Barto emphasise that this issue has been intensively studied by mathematicians for many decades, yet remains unresolved—there is no universally optimal strategy for exploration. On a stochastic task, each action must be tried many times to gain a reliable estimate of its expected reward. If the agent only exploits, it may settle too early for a suboptimal action. If it only explores, it may fail to benefit from what it has already learned. Good reinforcement learning therefore requires a practical balance between both.
1.20 When NOT to Update: Exploration Moves
In the tic-tac-toe scheme described above:
- After an exploitation move, we apply the TD update—we are confident that the next state was chosen because of our value estimates, so it carries useful information about .
- After an exploration move, we do not update. The action was random, so the resulting next state tells us little about whether is good or bad under our current policy.
1.21 The Role of the Step Size
The learning rate controls how quickly we trust new information:
| Value of | Behaviour |
|---|---|
| No update at all no learning. Values are frozen forever. | |
| We completely replace the old estimate with the new one. Learning becomes wildly unstable. | |
| Small constant (e.g., ) | Slow, stable learning. The agent keeps adapting forever to new opponents/conditions. |
| Decaying | Start large (learn quickly), decay over time (stabilize). |
1.22 A Common Exploration Strategy: -Greedy
A practical algorithm for balancing exploration and exploitation is -greedy:
Typically, is large at the start of training (say ) and decays toward a small value (say ) as the agent gains experience.
Putting It All Together
1.23 The General RL Recipe
- Initialize a value function (or a Q-function , or a policy ).
- Repeat for many episodes (games, trials, simulations):
- Observe the current state .
- Choose an action (mostly greedy, occasionally exploratory).
- Receive reward and next state .
- Update (or or ) using a TD-style rule: .
- Move on: .
- Over time, the value function (and hence the implicit policy) converges to something good.
1.24 Sequential Decision Problems
The setup we have described is more formally called a Sequential Decision Problem (SDP). At every time step the agent must:
- Observe the state.
- Choose an action.
- Receive a reward and a new state.
This may continue forever (continuing tasks) or stop at a terminal state (episodic tasks). Both will be formalised in the next lecture as Markov Decision Processes (MDPs).
Common Pitfalls and Clarifications
A reward of now does not necessarily mean a state is good—you might enter a low-value trap immediately afterwards. Always compare values (long-term expected return), not raw rewards, when deciding.
A naive student might think, “Let me give myself for everything!” But that defeats the purpose. The reward function defines the problem, and only the environment may dispense rewards.
There is no single “true value” of a state—only for a particular policy . Two different policies give two different value functions. When we write without a superscript, we are implicitly fixing a policy.
In TD(0), each game updates only the immediately preceding state’s value. So values propagate slowly—many games are needed to push reliable information across the table. This is fine; in fact, simulating thousands of games against a software opponent is exactly the standard approach.
Lecture Takeaways
- RL is learning by interacting with an environment to maximize cumulative reward.
- The five basic elements: agent, environment, state, action, reward; together with the derived concepts of policy and value function.
- RL is distinguished by: reward-based feedback, sequential decisions, delayed consequences, and the exploration–exploitation trade-off.
- Reward = immediate feedback (scalar, from the environment).
- Value = expected long-term return from under policy .
- Policy = the agent’s behaviour: probability of action in state .
- Policy and value are dual: good values greedy policy; consistent policy well-defined values.
- The tic-tac-toe TD update: .
- Tabular methods keep one value per state—great for small state spaces, infeasible for large ones (where deep RL takes over).
- Always balance exploration (try new things) and exploitation (use what you know). -greedy is a standard recipe.
- Keep the learning rate so the agent never stops adapting.
1.25 Historical Context
The field of reinforcement learning has deep roots. The term and modern framework trace back to the work of A. Harry Klopf in the late 1970s at Wright-Patterson Air Force Base. Klopf was dissatisfied with equilibrium-seeking models of intelligence and argued that maximizing systems—systems that actively try to maximize something—held the key to understanding natural intelligence. His ideas brought together Richard Sutton (then a Stanford undergraduate) and Andrew Barto (a newly-minted PhD at UMass Amherst) in 1979. Their collaboration, funded by AFOSR, produced the computational study of RL as we know it today.
However, the intellectual lineage goes back much further. In 1911, Edward Thorndike formulated the Law of Effect — arguably the first succinct expression of trial-and-error learning as a principle:
"Of several responses made to the same situation, those which are accompanied or closely followed by satisfaction to the animal will, other things being equal, be more firmly connected with the situation, so that, when it recurs, they will be more likely to recur; those which are accompanied or closely followed by discomfort to the animal will, other things being equal, have their connections with that situation weakened."— Edward Thorndike, Animal Intelligence (1911)
In 1948, Alan Turing described what may be the earliest computational design for a learning system based on the Law of Effect — a "pleasure-pain system":
"When a configuration is reached for which the action is undetermined, a random choice for the missing data is made and the appropriate entry is made in the description, tentatively, and is applied. When a pain stimulus occurs all tentative entries are cancelled, and when a pleasure stimulus occurs they are all made permanent."— Alan Turing, "Intelligent Machinery" (1948)
In the 1960s, Donald Michie built MENACE (Matchbox Educable Naughts and Crosses Engine) — a physical tic-tac-toe learner using matchboxes filled with coloured beads to represent state-action probabilities, with beads added or removed based on game outcomes. The BOXES system (Michie & Chambers, 1968) applied similar ideas to pole-balancing — one of the earliest reinforcement learning tasks under incomplete knowledge. Harry Klopf is the individual most responsible for reviving the trial-and-error research thread within AI in the 1970s, recognizing that the hedonic aspects of behaviour — the drive to achieve results from the environment — had been lost as researchers focused almost exclusively on supervised learning.
The field has since grown into one of the most active research areas in machine learning, with contributions from psychology, control theory, AI, and neuroscience. Key milestones include: TD-Gammon (Tesauro, 1992)—the first program to achieve world-champion level play using TD learning and neural networks; DQN (Mnih et al., 2015)—human-level Atari game play from raw pixels; AlphaGo (Silver et al., 2016)—defeating the world champion at Go; and AlphaGo Zero (2017)—learning superhuman Go without any human data.
1.26 Real-World Applications
| Domain | Examples |
|---|---|
| Game Playing | Tic-tac-toe, chess, Go, Atari, StarCraft, backgammon |
| Robotics | Balance, walking, navigation, grasping, manipulation |
| Autonomous Driving | Lane decisions, speed control, planning under uncertainty |
| Industrial Control | Refinery control, energy management, process optimisation |
| Operations | Scheduling, inventory control, traffic signals, resource allocation |
| Recommendation Systems | Personalisation, advertising, web services, content ranking |
| Healthcare & Education | Adaptive interventions, tutoring systems, treatment planning |
| Finance | Portfolio management, sequential bidding, risk-sensitive decisions |
Review of Key Terms
The following glossary summarizes essential terms required for reading Chapter 1 of Sutton & Barto and preparing for examinations:
| Term | Short Definition and Context |
|---|---|
| Agent | The learner and decision-maker that senses the state, selects actions, and improves behavior over time. |
| Environment | The external system outside the agent that receives actions and returns next states and numerical rewards. |
| State () | A formal representation of the current situation available to the agent at time step . |
| Action () | A decision, move, or choice selected by the agent at time step . |
| Reward () | Numerical scalar feedback received from the environment immediately after taking action in state . |
| Policy () | The agent’s behavior rule mapping perceived states to actions or probability distributions over actions. |
| Stochastic Policy | A policy that selects actions according to a probability distribution, denoted . |
| Reward Signal | The immediate scalar signal defining what is good or bad; primary basis for altering policy. |
| Value Function | An estimate of expected long-term cumulative reward starting from a state or state-action pair. |
| State-Value Function () | A function estimating how good it is to be in a particular state under a given policy. |
| Action-Value Function () | A function estimating how good it is to take action in state and follow policy thereafter. |
| Model | A mechanism mimicking environment dynamics that predicts next state and reward given state and action. |
| Planning | Choosing actions by simulating possible future situations using a model before they are experienced. |
| Model-Based Method | An algorithm that uses an explicit model of the environment for planning or prediction (e.g., Dynamic Programming, MCTS). |
| Model-Free Method | An algorithm that learns directly from experience without an explicit environment model (e.g., Q-learning, TD learning). |
| Exploration | Trying less-known actions to discover new information and potentially better outcomes. |
| Exploitation | Selecting actions currently estimated to produce the highest reward. |
| Delayed Reward | A scenario where consequences of an action arrive much later, requiring multi-step foresight. |
| Credit Assignment | The problem of determining which earlier actions contributed to later success or failure. |
| Temporal-Difference Error | The discrepancy between successive value estimates used to update earlier predictions. |
| Episode | A complete sequence of interaction from a starting state to a terminal state. |
| Terminal State | A state at which an episode terminates (e.g., win, loss, or draw in tic-tac-toe). |
1.27 Further & Required Reading
- Required Reading: Sutton, R. S., and Barto, A. G. (2018). Reinforcement Learning: An Introduction (2nd ed.). MIT Press. Chapter 1, especially Sections 1.1 to 1.5 covering definitions, examples, core elements, and the tic-tac-toe illustration.
- Next Steps: Skim the book’s table of contents to prepare for Markov Decision Processes (MDPs), Bellman equations, dynamic programming, and TD learning.
1.28 Review & Self-Check Questions
Use these examination preparation and self-check questions to verify that you have absorbed the lecture:
- Define reinforcement learning using the agent–environment interaction framework. Explain the roles of state, action, reward, and cumulative reward.
- Compare reinforcement learning with supervised learning and unsupervised learning. Clearly distinguish instructive feedback from evaluative feedback.
- Explain the four main elements of reinforcement learning: policy, reward signal, value function, and model. Why is the value function especially important for long-term decision-making?
- Discuss the exploration–exploitation trade-off. Why can an agent fail if it only exploits current knowledge or only explores new actions?
- In the tic-tac-toe example, explain how state values are initialized, how moves are selected, and how the temporal-difference update changes the value of an earlier state.
- In one sentence, what distinguishes RL from supervised learning?
- What is the difference between an immediate reward and a cumulative return?
- Why does a state's value function strictly depend on the agent's policy?
- Why does the basic TD update for tic-tac-toe not fire after exploratory moves?
- What happens if the learning rate is set to 0? What happens if it is set to 1?
- Give an example from everyday life illustrating a delayed reward and credit assignment.
- Why are tabular methods insufficient for problems with large state spaces like Go or Atari?
End of Lecture 1 Notes. In the next lecture we will formalise the agent–environment interaction as a Markov Decision Process (MDP) and study Bellman equations.
Key takeaway
Introduction to Reinforcement Learning ties the lecture together: master the core definitions before moving to applications.
DRL Lecture 1 Notes · Introduction to Reinforcement Learning
Sections Breakdown
This is, arguably, the most natural form of learning: it is how humans, animals, and even infants learn. A baby is not given labelled examples of “how to walk”;
To appreciate RL, contrast it with the two paradigms you may already know:
Classical RL is built on tables and tabular updates (we will see exactly this in the tic-tac-toe example). But for problems with huge state spaces (Atari frames
The two fundamental entities in RL are the agent and the environment.
At every discrete time step \(t = 0, 1, 2, \dots\) the following loop runs:
1.4 The Five Core Elements
Beyond the agent and the environment, Sutton & Barto identify four main sub-elements in a reinforcement learning system:
RL is well-suited to problems in large environments when any of these hold:
1.7 Examples of Agent-Environment Pairs
RL differs from supervised learning in several important ways:
Rewards, Returns, and Value Functions
Maximizing the immediate reward \(R_{t+1}\) is not enough. The agent should maximize the cumulative reward—called the return—starting from time \(t\
Intuitively: the policy is “my way of working.” Given a situation, what do I do? Two different agents in the same state can choose different actions because the
1.10 Value Function: Long-Term Desirability
Consider an environment with only two states \(S_1\) and \(S_2\), and two actions: \(L\) (left) and \(R\) (right).
1.12 The Policy-Value Duality
We now apply RL to a concrete game. This example is adapted from Sutton & Barto, Chapter 1, and it illustrates almost every idea from the lecture.
Two players (agent vs. opponent) alternate placing \(\times\) and \(\circ\) on a \(3 \times 3\) grid. The agent plays \(\times\). There are three possible outco
In the AI course you may study minimax search or alpha-beta pruning for games. These methods:
We maintain a table with one row per possible board state. Each row stores a single number \(V(s)\) representing the current estimate of the value of that state
Suppose the opponent has just moved, giving the agent a board configuration \(B\). From \(B\), the agent has several possible moves leading to states \(C_1, C_2
After the agent makes a greedy move from state \(A\) to a state \(A'\) (via the opponent and the agent’s greedy choice), it updates the value of \(A\) to be clo
Notice that we update \(V(A)\) using \(V(A')\), which is itself only an estimate. This is called bootstrapping : we learn an estimate from another estimate.
Exploration vs. Exploitation
A driver who only follows the GPS will never discover a faster shortcut. A driver who always experiments with random side streets is reckless and never reaches
In the tic-tac-toe scheme described above:
The learning rate \(\alpha\) controls how quickly we trust new information:
A practical algorithm for balancing exploration and exploitation is \(\epsilon\)-greedy :
Putting It All Together
1.23 The General RL Recipe
The setup we have described is more formally called a Sequential Decision Problem (SDP) . At every time step the agent must:
A reward of \(+10\) now does not necessarily mean a state is good—you might enter a low-value trap immediately afterwards. Always compare values (long-ter
Lecture Takeaways
The field of reinforcement learning has deep roots. The term and modern framework trace back to the work of A. Harry Klopf in the late 1970s at Wright-Patterson
1.26 Real-World Applications
1.27 Further Reading
Use these to verify that you absorbed the lecture:
Exam Revision Notes
Below is the distilled, exam-ready core of this lecture. Every entry is built from the full textbook notes above. Use this section for rapid review — but if something doesn't make sense, go back to the full explanation in the main content.
What is Reinforcement Learning?
Must-know: This is, arguably, the most natural form of learning: it is how humans, animals, and even infants learn. A baby is not given labelled examples of “how to walk”; it tries, falls, gets feedback (pain, support from a parent, balance restored), and gradually improves.
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise What is Reinforcement Learning?; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain What is Reinforcement Learning? in your own words, and give one concrete example.
Connects to: The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?, The Agent–Environment Interface.
The Three Paradigms of Learning
Must-know: To appreciate RL, contrast it with the two paradigms you may already know:
Top pitfall: Don't just memorise The Three Paradigms of Learning; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain The Three Paradigms of Learning in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, Why "Deep" Reinforcement Learning?, The Agent–Environment Interface.
Why "Deep" Reinforcement Learning?
Must-know: Classical RL is built on tables and tabular updates (we will see exactly this in the tic-tac-toe example). But for problems with huge state spaces (Atari frames, robotic joint configurations, Go boards), we cannot store one entry per state.
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise Why "Deep" Reinforcement Learning?; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Why "Deep" Reinforcement Learning? in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, The Agent–Environment Interface.
The Agent–Environment Interface
Must-know: The two fundamental entities in RL are the agent and the environment.
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Intuition: A useful rule of thumb (Sutton & Barto): anything that cannot be changed arbitrarily by the agent is part of the environment. If the agent decides to press the brake, "pressing the brake" is an action—but how the brake actually responds is part of the environment.
Self-check: Explain The Agent–Environment Interface in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
The Interaction Loop
Must-know: At every discrete time step the following loop runs:
Top pitfall: Don't just memorise The Interaction Loop; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain The Interaction Loop in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
The Five Core Elements
Must-know: This section introduces The Five Core Elements.
Top pitfall: Important Note: The reward is a property of the environment, not the agent. The agent must not be allowed to design or modify its own reward—that would be like a student deciding their own marks. The reward function defines the problem; the agent’s job is to maximize it.
Self-check: Explain The Five Core Elements in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
The Fourth Sub-Element: Model of the Environment
Must-know: Beyond the agent and the environment, Sutton & Barto identify four main sub-elements in a reinforcement learning system:
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise The Fourth Sub-Element: Model of the Environment; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain The Fourth Sub-Element: Model of the Environment in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
When to Use Reinforcement Learning
Must-know: RL is well-suited to problems in large environments when any of these hold:
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise When to Use Reinforcement Learning; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain When to Use Reinforcement Learning in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Examples of Agent-Environment Pairs
Must-know: This section introduces Examples of Agent-Environment Pairs.
Top pitfall: Don't just memorise Examples of Agent-Environment Pairs; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Examples of Agent-Environment Pairs in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Key Characteristics of Reinforcement Learning
Must-know: RL differs from supervised learning in several important ways:
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Intuition: A short reflection: in life you sometimes endure short-term pain (study late, exercise, save money) for long-term gain. Other times, short-term pleasure (skipping a workout) leads to long-term regret. RL formalises exactly this: maximize long-term return.
Self-check: Explain Key Characteristics of Reinforcement Learning in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Rewards, Returns, and Value Functions
Must-know: This section introduces Rewards, Returns, and Value Functions.
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise Rewards, Returns, and Value Functions; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Rewards, Returns, and Value Functions in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
From Reward to Return
Must-know: Maximizing the immediate reward is not enough. The agent should maximize the cumulative reward—called the return—starting from time .
Top pitfall: Intuition (Why discount?): If the agent lives forever and every step gives a finite reward, the undiscounted sum can be infinite—and we cannot compare two infinite sums to decide which is better. The discount factor ensures the sum is finite.
Self-check: Explain From Reward to Return in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Policy: The Agent's Way of Working
Must-know: Intuitively: the policy is “my way of working.” Given a situation, what do I do? Two different agents in the same state can choose different actions because they have different policies.
Top pitfall: Don't just memorise Policy: The Agent's Way of Working; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Policy: The Agent's Way of Working in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Value Function: Long-Term Desirability
Must-know: This section introduces Value Function: Long-Term Desirability.
Top pitfall: Sutton & Barto's Analogy: Rewards are somewhat like pleasure (if high) and pain (if low) — they are the immediate, defining features of the problem faced by the agent. Values, in contrast, correspond to a more refined long-term judgment of how pleased or displeased we are to be in a particular state.
Self-check: Explain Value Function: Long-Term Desirability in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
A Two-State Toy Example
Must-know: Consider an environment with only two states and , and two actions: (left) and (right).
Top pitfall: Don't just memorise A Two-State Toy Example; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain A Two-State Toy Example in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
The Policy-Value Duality
Must-know: This section introduces The Policy-Value Duality.
Top pitfall: Don't just memorise The Policy-Value Duality; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain The Policy-Value Duality in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
A Worked Example: Learning Tic-Tac-Toe with RL
Must-know: We now apply RL to a concrete game. This example is adapted from Sutton & Barto, Chapter 1, and it illustrates almost every idea from the lecture.
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise A Worked Example: Learning Tic-Tac-Toe with RL; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain A Worked Example: Learning Tic-Tac-Toe with RL in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Problem Setup
Must-know: Two players (agent vs. opponent) alternate placing and on a grid. The agent plays . There are three possible outcomes:
Top pitfall: Important Note: The reward is only emitted at the end of a game. Intermediate moves get no immediate reward. This is a classic case of delayed rewards.
Self-check: Explain Problem Setup in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Why Not Just Use Exhaustive Search?
Must-know: In the AI course you may study minimax search or alpha-beta pruning for games. These methods:
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise Why Not Just Use Exhaustive Search?; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Why Not Just Use Exhaustive Search? in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
The Tabular Value Function
Must-know: We maintain a table with one row per possible board state. Each row stores a single number representing the current estimate of the value of that state.
Top pitfall: Intuition: The initial values reflect prior knowledge. We know the value of terminal states (we can see who won). For unknown intermediate states, is a neutral starting guess; learning will adjust these values over time.
Self-check: Explain The Tabular Value Function in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Choosing Moves: Greedy Action Selection
Must-know: Suppose the opponent has just moved, giving the agent a board configuration . From , the agent has several possible moves leading to states .
Top pitfall: Don't just memorise Choosing Moves: Greedy Action Selection; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Choosing Moves: Greedy Action Selection in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
The Temporal-Difference (TD) Update Rule
Must-know: After the agent makes a greedy move from state to a state (via the opponent and the agent’s greedy choice), it updates the value of to be closer to the value of :
Top pitfall: Intuition: Why this update? If I thought but my best follow-up has value , then my estimate of was too optimistic—I should decrease it. Conversely, if my best follow-up has value , is better than I thought, so I should increase its value.
Self-check: Explain The Temporal-Difference (TD) Update Rule in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Bootstrapping and Backing Up Values
Must-know: Notice that we update using , which is itself only an estimate. This is called bootstrapping : we learn an estimate from another estimate.
Top pitfall: Convergence Guarantee (Sutton & Barto): If the step-size parameter is reduced properly over time, this TD method converges, for any fixed opponent, to the true probabilities of winning from each state given optimal play.
Self-check: Explain Bootstrapping and Backing Up Values in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Exploration vs. Exploitation
Must-know: This section introduces Exploration vs. Exploitation.
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise Exploration vs. Exploitation; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Exploration vs. Exploitation in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
The Dilemma
Must-know: A driver who only follows the GPS will never discover a faster shortcut. A driver who always experiments with random side streets is reckless and never reaches a destination. The skill is in the balance.
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Intuition: Why is this a dilemma? Your value estimates are based on limited experience. They might be wrong. The only way to find out whether a seemingly bad action is actually good is to try it. But trying “bad-looking”
Self-check: Explain The Dilemma in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
When NOT to Update: Exploration Moves
Must-know: In the tic-tac-toe scheme described above:
Top pitfall: Important Note: This is specific to the simple scheme presented in this lecture. More sophisticated algorithms (like Q-learning or Expected SARSA) update on exploration moves too, using clever weightings. But the lecture
Self-check: Explain When NOT to Update: Exploration Moves in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
The Role of the Step Size
Must-know: The learning rate controls how quickly we trust new information:
Top pitfall: Don't just memorise The Role of the Step Size ; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain The Role of the Step Size in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
A Common Exploration Strategy: -Greedy
Must-know: A practical algorithm for balancing exploration and exploitation is -greedy :
Top pitfall: Don't just memorise A Common Exploration Strategy: -Greedy; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain A Common Exploration Strategy: -Greedy in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Putting It All Together
Must-know: This section introduces Putting It All Together.
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise Putting It All Together; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Putting It All Together in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
The General RL Recipe
Must-know: This section introduces The General RL Recipe.
Top pitfall: Don't just memorise The General RL Recipe; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain The General RL Recipe in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Sequential Decision Problems
Must-know: The setup we have described is more formally called a Sequential Decision Problem (SDP) . At every time step the agent must:
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise Sequential Decision Problems; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Sequential Decision Problems in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Common Pitfalls and Clarifications
Must-know: A reward of now does not necessarily mean a state is good—you might enter a low-value trap immediately afterwards. Always compare values (long-term expected return), not raw rewards, when deciding.
Top pitfall: Pitfall 1: Reward vs. Value A reward of now does not necessarily mean a state is good—you might enter a low-value trap immediately afterwards. Always compare values (long-term expected return), not raw rewa
Self-check: Explain Common Pitfalls and Clarifications in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Lecture Takeaways
Must-know: This section introduces Lecture Takeaways.
Top pitfall: Key Points to Remember: RL is learning by interacting with an environment to maximize cumulative reward. The five basic elements: agent, environment, state, action, reward; together with the derived concepts of policy an
Self-check: Explain Lecture Takeaways in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Historical Context
Must-know: The field of reinforcement learning has deep roots. The term and modern framework trace back to the work of A. Harry Klopf in the late 1970s at Wright-Patterson Air Force Base. Klopf was dissatisfied with equilibrium-seeking models of intelligence and argued that maximizing systems —systems that actively try to maxi...
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise Historical Context; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Historical Context in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Real-World Applications
Must-know: This section introduces Real-World Applications.
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Common Thread: In each application, the central pattern is the same. The agent must act now, observe what happens, and improve future decisions. A single action cannot be judged only by its immediate effect—it must be ju
Self-check: Explain Real-World Applications in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Further Reading
Must-know: This section introduces Further Reading.
N/A — conceptual topic; focus on the definitions and intuition above.
Top pitfall: Don't just memorise Further Reading; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Further Reading in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Self-Check Questions
Must-know: Use these to verify that you absorbed the lecture:
Top pitfall: Don't just memorise Self-Check Questions; make sure you can apply it to a novel example under exam pressure.
Self-check: Explain Self-Check Questions in your own words, and give one concrete example.
Connects to: What is Reinforcement Learning?, The Three Paradigms of Learning, Why "Deep" Reinforcement Learning?.
Was this lecture useful?
BitsNotes AI Assistant
Subject Notes AssistantConfigure AI Chat
Choose how to access the chatbotSigned in as
Powered by BitsNotes — 20 messages per day. No API key needed. Want unlimited access? Use "Bring Your Own Key" mode.
Sign in to use AI Chat
Get 20 free AI messages per day to ask questions about your lecture notes. Sign in with Google or GitHub — it takes 5 seconds.
Sign In to BitsNotesSwitch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.