Recommended resources
The freely available resources this lesson will direct you to.
- RL Course by David Silver - Lecture 1: Introduction to Reinforcement Learningwww.youtube.com
- Stanford CS234 Reinforcement Learning I Introduction to Reinforcement Learning I 2024 I Lecture 1www.youtube.com
- An Introduction to Deep Reinforcement Learninghal.science
- Part 1: Key Concepts in RL — Spinning Up documentationspinningup.openai.com
Introduction
Welcome to a new module in our journey. Having just concluded our deep dive into generative AI with diffusion models, we now pivot to an entirely different and foundational paradigm of machine learning: Reinforcement Learning (RL). While supervised learning learns from labeled data and unsupervised learning finds patterns in unlabeled data, reinforcement learning is about learning to achieve goals through interaction with an environment. It is the theoretical framework behind an agent that learns optimal behavior through trial and error.
This lesson establishes the fundamental vocabulary and conceptual structure of RL. We will define the five core components that form the basis of every reinforcement learning problem: the agent, the environment, the state, the action, and the reward. By the end of this lesson, you will be able to describe this interactive framework and formalize it mathematically as a Markov Decision Process, setting the stage for all subsequent RL concepts.
The Reinforcement Learning Paradigm
At its heart, RL is a framework for sequential decision-making. It stands apart from the supervised and unsupervised paradigms you've seen so far. The legendary RL researcher David Silver provides an excellent overview of these distinctions. His lecture will help you build a strong intuition for what makes RL a unique and powerful tool.
RL Course by David Silver - Lecture 1: Introduction to Reinforcement Learning
This is the first lecture from the highly-regarded RL course by David Silver at DeepMind. We will use it to understand the fundamental philosophy of RL.
Please watch the segment from "which differentiate reinforcement learning". As you watch, focus on the four key distinctions he outlines: No supervisor: The agent isn't told the "correct" action; it only receives a feedback signal (reward). Delayed feedback: The consequences of an action may not be immediately apparent. Sequential process: Time is a crucial element; decisions are not independent and identically distributed (IID). Agent's actions affect subsequent data: The agent actively influences the data it receives by exploring its environment.
These characteristics—particularly the departure from IID data and the agent's active role in data collection—present unique theoretical challenges that we will unpack throughout this module.
The Agent-Environment Interaction Loop
The entire RL framework can be understood through the interaction between two primary entities: the agent and the environment.
- The Agent is the learner and decision-maker. It is the algorithm we are trying to design.
- The Environment is everything outside the agent. It is the world the agent interacts with, and it encompasses the problem or task the agent is meant to solve.
This interaction happens over a sequence of discrete time steps. At each step , the agent receives information about the environment, selects an action, and the environment responds. This creates a continuous feedback loop.

The communication between the agent and the environment is mediated by three key components:
- State (): A representation of the environment at time .
- Action (): A choice made by the agent at time .
- Reward (): A scalar feedback signal received by the agent after taking action in state .
Let's examine each of these components in more detail.
State and Observation
The state is a complete description of the world. An observation is a partial description. This distinction is critical.
Part 1: Key Concepts in RL — Spinning Up documentation
The OpenAI Spinning Up documentation provides clear and standard definitions for RL terminology.
Please read the section on States and Observations. Note the difference between a fully observed environment, where the agent sees the true state, and a partially observed one, where it only gets an observation.
For instance, in a game of chess, the state is the position of all pieces on the board. The environment is fully observed. In a game of poker, your observation consists of your own cards and the public cards, but the true state includes your opponents' cards, which are hidden. This is a partially observed environment.
Given your background, you'll appreciate the deeper theoretical distinctions here. The "state" can be decomposed further. David Silver's lecture provides a lucid breakdown.
RL Course by David Silver - Lecture 1: Introduction to Reinforcement Learning
This part of David Silver's lecture offers a precise, formal treatment of 'state'.
Watch the segment from "the history isn't very useful". Pay close attention to his definitions of: History: The full sequence of past observations, actions, and rewards. Environment State: The private, internal representation the environment uses to determine what happens next. It is often hidden from the agent. Agent State: The internal representation the agent uses to make decisions. This is what our algorithm controls. Information State (Markov State): A state representation that has the Markov Property—meaning the future is independent of the past, given the present. This is a sufficient summary of the history.
The concept of the Markov state is the theoretical bedrock upon which most of RL is built. It allows us to make decisions based on the current state alone, without needing the entire history of interactions.
Action
The action is how the agent influences the environment. The set of all possible actions is called the action space.
Part 1: Key Concepts in RL — Spinning Up documentation
Now, let's look at how actions are defined.
Read the short section on Action Spaces in the Spinning Up document.
The nature of the action space—whether it is discrete (a finite set of actions, like "up," "down," "left," "right") or continuous (actions are real-valued vectors, like the amount of torque to apply to a robot's joints)—has significant implications for the types of algorithms that can be used.
Reward and the Goal
The reward is a scalar signal, , that indicates how well the agent is doing at a given time step. The agent's goal is to maximize not the immediate reward, but the cumulative reward over time. This concept is captured by the Reward Hypothesis.
RL Course by David Silver - Lecture 1: Introduction to Reinforcement Learning
Let's return to David Silver's lecture for a discussion of the reward's central role.
Watch the segment from "one of the most fundamental quantities". This section introduces the Reward Hypothesis: the idea that all goals can be framed as the maximization of the expected cumulative reward. He also addresses how to formulate goals like "finish as fast as possible" using a reward of -1 for every time step.
This simple but powerful hypothesis allows us to frame complex goals in a mathematically tractable way. Designing a reward function that correctly specifies the desired behavior without leading to unintended "hacks" (like a robot sweeping dishes onto the floor to "clean" the counter) is a central challenge in applied RL known as reward engineering.
The sequence of states, actions, and rewards generated by the interaction loop is called a trajectory or an episode: . The agent's ultimate objective is to learn a strategy for choosing actions that maximizes the total expected reward over such trajectories.
Formalizing the Framework: The Markov Decision Process (MDP)
When the environment is fully observable (i.e., the agent's observation is the true environment state) and possesses the Markov property, we can formalize the entire RL problem as a Markov Decision Process (MDP). The MDP is the canonical mathematical framework for RL.
An MDP is defined as a tuple , where:
- is the set of all possible states (the state space).
- is the set of all possible actions (the action space).
- is the transition dynamics function, . It defines the probability of transitioning to state after taking action in state .
- is the reward function. A common definition is , the reward received after transitioning from to via action .
- is the distribution of the initial state, .
The following resources provide excellent formal definitions.
An Introduction to Deep Reinforcement Learning
This paper provides a concise, academic formalization of the MDP.
Please read the section 2.1 Markov Decision Processes. Focus on how it maps the conceptual components (states, actions, etc.) to the formal mathematical objects in the MDP tuple. Pay attention to the distinction between deterministic and stochastic transitions.
Part 1: Key Concepts in RL — Spinning Up documentation
The Spinning Up documentation also has a clear, optional section on the MDP formalism.
Find the final section titled "(Optional) Formalism" and read it. This will reinforce the definitions you just saw and explicitly state the Markov property in the context of the MDP.
A Concrete Example: Grid World
Let's ground these abstract concepts in a simple example from the "Introduction to Deep Reinforcement Learning" paper.
This is a simple grid world environment. The agent (robot) starts at a designated position and must navigate to the trophy cell.
Let's define the MDP for this task:
- States (): The set of 11 grid cells where the agent can be. .
- Actions (): The set of four cardinal movements: .
- Transition Function ():
- In a deterministic world, if the agent is in cell and takes the action 'right', the next state is with probability 1. .
- In a stochastic world, the action might fail. For example, trying to move 'right' might succeed with probability 0.9, but with probability 0.1, the agent stays in place. and .
- Reward Function (): As shown in the image, the reward is +1 for entering the trophy cell, and -0.01 for entering any other cell. The small negative reward encourages the agent to find the goal as quickly as possible.
This simple example encapsulates all the core components and their formal relationships within an MDP.
Conclusion
In this lesson, we have laid the theoretical groundwork for our study of Reinforcement Learning. We've moved from the high-level paradigm of learning through interaction to a precise, mathematical formulation.
Here are the key takeaways:
- The RL Framework: Consists of an agent learning to make decisions by interacting with an environment.
- Core Components: The interaction is defined by a loop of state representations, agent actions, and resulting rewards.
- Agent's Goal: To maximize the cumulative reward (the return) over a trajectory.
- The Reward Hypothesis: All goals can be represented as the maximization of expected cumulative reward.
- The MDP Formalism: In fully observable settings, the RL problem is formally modeled as a Markov Decision Process (MDP), defined by a tuple . The Markov Property is the key assumption that makes this framework tractable.
We have defined the problem, but not yet the solution. The agent's "brain," or its strategy for choosing actions, is called a policy. How does an agent learn a good policy? How does it estimate the long-term value of being in a particular state?
In our next lesson, we will answer these questions by deriving the Bellman equation, a fundamental identity that relates the value of a state to the value of its successor states. This equation is the cornerstone of nearly all RL algorithms.