1. Definition
Reinforcement Learning (RL) is a type of Machine Learning in which an agent learns by interacting with an environment and receives rewards or penalties based on its actions.
In very simple language:
Reinforcement Learning means learning by trial and error, where good actions receive rewards and bad actions receive penalties.
Learn more
The above visual is useful for understanding the general idea of making decisions based on outcomes, but remember that reinforcement learning specifically works through actions, states, rewards and feedback over time.
2. Basic Idea
Imagine teaching a dog a new trick.
- Dog performs the correct action → Reward
- Dog performs the wrong action → No reward/Penalty
- Dog tries again
- Eventually, the dog learns which action gives the best result.
Reinforcement learning works in a similar way.
Environment
↓
State
↓
Agent
↓
Action
↓
Environment
↓
Reward
↓
Agent
The agent continuously learns from this interaction.
3. Important Terms
There are four important terms in reinforcement learning:
1. Agent
The agent is the learner or decision-maker.
Examples:
- Robot
- Computer program
- Game-playing AI
- Self-driving vehicle
2. Environment
The environment is the world in which the agent operates.
Examples:
- Chess board
- Road
- Video game
- Robot’s surroundings
3. Action
An action is something the agent performs.
For example, in a game:
- Move left
- Move right
- Jump
- Attack
4. Reward
A reward is feedback received by the agent after performing an action.
For example:
| Action | Result |
|---|---|
| Correct action | +10 reward |
| Wrong action | -10 penalty |
| Neutral action | 0 |
The agent tries to learn actions that produce maximum total reward.
4. How Reinforcement Learning Works
Step 1: Agent observes the environment
The agent identifies the current state.
Step 2: Agent chooses an action
It decides what to do.
Step 3: Environment responds
The environment changes because of the action.
Step 4: Agent receives reward or penalty
The agent gets feedback.
Step 5: Agent learns
It updates its behaviour so that it can make better decisions in the future.
This process continues repeatedly.
State
↓
Agent chooses Action
↓
Environment changes
↓
Reward / Penalty
↓
Agent learns
↓
New State
↓
New Action
↓
...
5. Real-Life Example – Robot Learning to Walk
Suppose we want a robot to learn how to walk.
Initially, the robot doesn’t know what to do.
Trial 1
Robot moves its leg → falls down.
Penalty = -10
Trial 2
Robot changes its movement → remains standing.
Reward = +5
Trial 3
Robot moves correctly → takes one step.
Reward = +10
After thousands of attempts, the robot learns which movements help it walk.
So:
Trial and Error → Feedback → Learning → Better Actions
6. Example – Game Playing
Suppose an AI is learning to play a game.
Game State
↓
AI chooses action
↓
Move the player
↓
Game result
↓
Reward / Penalty
↓
AI learns
For example:
- Winning → +100
- Losing → -100
- Collecting points → +10
- Hitting an obstacle → -10
The AI gradually learns a strategy that maximizes its total reward.
7. Example – Self-Driving Car
A self-driving car can be considered an agent.
Environment
Road and traffic.
State
- Position of car
- Speed
- Traffic
- Pedestrians
- Traffic signals
Actions
- Accelerate
- Brake
- Turn left
- Turn right
Rewards
Safe driving → Positive reward
Collision → Large negative reward
The system learns to choose actions that maximize safety and other objectives.
8. Reinforcement Learning vs Supervised Learning
| Supervised Learning | Reinforcement Learning |
|---|---|
| Uses labelled data | Learns through interaction |
| Correct answer is provided | Correct answer is not directly provided |
| Learns from examples | Learns through trial and error |
| Feedback is usually the known label | Feedback comes as rewards/penalties |
| Example: Spam classification | Example: Game-playing AI |
Easy example
Supervised Learning:
Teacher says: “This answer is correct.”
Reinforcement Learning:
“Try this action. You got +10 reward. Try to learn from it.”
9. Advantages
- Learns through experience.
- Does not require a labelled dataset for every action.
- Can solve complex decision-making problems.
- Suitable for dynamic environments.
- Can learn strategies through repeated interaction.
- Useful for automation and intelligent control.
10. Disadvantages
- Training can take a long time.
- Requires many trials and interactions.
- Designing an appropriate reward system can be difficult.
- Poorly designed rewards can lead to undesirable behaviour.
- Training can require significant computational resources.
- Learning through real-world trial and error can sometimes be expensive or risky.
11. Applications
Reinforcement learning is used in:
- 🎮 Game playing
- 🤖 Robotics
- 🚗 Autonomous vehicles
- 🏭 Industrial automation
- 💹 Resource optimization
- 🛒 Recommendation and personalization
- 📦 Logistics and route optimization
- ⚡ Energy management
12. Key Components
Remember these five important terms for the exam:
Agent + Environment + State + Action + Reward
ENVIRONMENT
↕
STATE / ACTION
↕
AGENT
↓
REWARD
The agent’s objective is generally to learn a policy that maximizes the cumulative reward over time.
⭐ Exam Answer
Reinforcement Learning is a type of Machine Learning in which an agent learns by interacting with an environment. The agent observes the current state, performs an action, and receives a reward or penalty from the environment. Through repeated trial and error, the agent learns which actions produce better results. The main components of reinforcement learning are agent, environment, state, action and reward. It is widely used in robotics, game playing, autonomous vehicles and industrial automation.
One-line memory trick:
Reinforcement Learning = Trial + Action + Reward/Penalty + Learning.
