What Is Chain-of-Thought Prompting?
Understand the technique that dramatically improves AI reasoning on complex problems.
Chain-of-Thought (CoT) prompting is a technique where you ask the AI to show its reasoning process before arriving at a final answer. Instead of jumping straight to a conclusion, the model walks through intermediate steps — just like a student showing their work on a math exam.
This technique was first formalized by Google researchers in 2022, but the core idea is intuitive: when you force a model to reason through a problem step by step, it makes fewer errors. The intermediate steps act as a scaffold that keeps the model's "thinking" on track.
Large language models generate text one token at a time. Without CoT, the model must compress all its reasoning into a single jump from question to answer. With CoT, each intermediate step becomes part of the context for the next step, giving the model more "working memory" to solve complex problems.
Prompt
See the difference CoT makes on a reasoning problem.
Without CoT
Prompt: "A store has 15 apples. They sell 8, receive a shipment of 20, then sell 12. How many apples remain?" Answer: 13 apples.
With CoT
Prompt: "A store has 15 apples. They sell 8, receive a shipment of 20, then sell 12. How many apples remain? Think step by step." Step 1: Start with 15 apples. Step 2: Sell 8 → 15 - 8 = 7 apples. Step 3: Receive 20 → 7 + 20 = 27 apples. Step 4: Sell 12 → 27 - 12 = 15 apples. Answer: 15 apples remain.
- Multi-step math and logic problems
- Complex reasoning that requires combining multiple facts
- Coding problems that involve algorithmic thinking
- Analysis tasks where you need to weigh multiple factors
- Word problems and puzzles with tricky setups
There are two main approaches: Few-Shot CoT, where you provide examples of step-by-step reasoning before your question, and Zero-Shot CoT, where you simply add a phrase like "Think step by step" or "Let's work through this." We'll cover Zero-Shot CoT in the next lesson.
Few-Shot CoT Example
Provides worked examples before your question to guide step-by-step reasoning.
Here's how to solve word problems step by step: Q: Roger has 5 tennis balls. He buys 2 cans of 3 tennis balls each. How many does he have now? A: Roger starts with 5 balls. He buys 2 cans × 3 balls = 6 balls. Total: 5 + 6 = 11 tennis balls. Q: The cafeteria had 23 apples. They used 20 for lunch and bought 6 more. How many apples do they have? A: Start with 23. Used 20 → 23 - 20 = 3. Bought 6 more → 3 + 6 = 9 apples. Q: [YOUR PROBLEM HERE] A:
Prompt Templates
Step-by-Step Reasoner
General-purpose CoT prompt for any reasoning problem.
I need you to solve this problem. Show your complete reasoning process step by step before giving the final answer. Problem: [YOUR PROBLEM] Walk through each step of your reasoning. Number each step. After all steps, clearly state your final answer.
Logic Problem Solver
Structured CoT for logic puzzles and deductive reasoning.
Solve this logic problem using careful step-by-step deduction: [PROBLEM] For each step: 1. State what information you're using 2. State what conclusion you can draw 3. Explain why that conclusion follows After working through all deductions, state your final answer.
Test Your Knowledge
Knowledge Check
1 / 3
What is Chain-of-Thought prompting?
Key Takeaways
- ✓Chain-of-Thought prompting asks the model to show intermediate reasoning steps before the final answer
- ✓CoT works because each step provides context for the next, expanding the model's effective working memory
- ✓It is most effective on multi-step reasoning, math, logic, and complex analysis tasks
- ✓CoT also makes errors debuggable — you can see where the reasoning went wrong
- ✓Few-Shot CoT provides worked examples; Zero-Shot CoT uses trigger phrases like "think step by step"
Continue Learning
Zero-Shot Chain-of-Thought
The simplest way to trigger reasoning — just add one phrase to your prompt.
When CoT Hurts in Modern Models
Chain-of-thought is not always beneficial. Learn when to skip it.
GPT vs Claude vs Gemini
Understand the practical differences between the major AI models.