Learn about Chain-of-Thought (CoT) prompting, a technique that encourages AIs to show their reasoning process for more accurate and reliable answers to complex problems. Lecture 10
Thinking Step-by-Step
Welcome to Part 3 of the course! We’re now getting into more advanced territory. Today, we’re looking at a powerful technique called Chain-of-Thought (CoT) Prompting.
When you have a complex problem, especially one involving math, logic, or multiple steps, you get better answers if you ask the AI to “think out loud” and explain its reasoning process. This step-by-step thinking is called a Chain of Thought.
Why Does This Work?
Large Language Models are great at pattern matching. When you ask for a direct answer to a complex question, the AI might rush and make a mistake. It tries to jump from the question straight to the answer.
However, by asking it to explain its steps, you force it to slow down and follow a logical sequence. This often leads to more accurate results because breaking a big problem into smaller, manageable steps is easier than solving it all at once.
Example: A Simple Math Problem
Let’s see the difference with a word problem.
Standard Prompt
Q: John has 5 apples. He buys 3 more boxes of apples, and each box contains 4 apples. How many apples does John have now? A:
An AI might quickly calculate 5 + 3 * 4 and give the correct answer, 17. But for more complex problems, it could easily make a mistake.
Chain-of-Thought Prompt
Q: John has 5 apples. He buys 3 more boxes of apples, and each box contains 4 apples. How many apples does John have now?
A: Let's think step by step.
1. First, calculate the number of apples in the boxes. John buys 3 boxes with 4 apples each. 3 * 4 = 12 apples.
2. Next, add the new apples to the apples John already had. He started with 5 apples. 5 + 12 = 17 apples.
So, the final answer is 17.
By showing the reasoning, we make the process clear and can easily check the logic.
How to Trigger a Chain of Thought
There are two main ways to use CoT prompting:
1. Zero-Shot CoT (The Easy Way)
You can simply add a phrase to your prompt that encourages the AI to think step-by-step. This is surprisingly effective!
Just add one of these phrases to the end of your prompt:
"Let's think step by step."
"Take a deep breath and work on this problem step-by-step."
"Show your work."
"Explain your reasoning before giving the final answer."
2. Few-Shot CoT
This is the method from the original research paper and is very powerful. You provide an example (a “few-shot”) in your prompt that includes a question and a detailed, step-by-step answer. Then, you ask your new question and let the AI follow the pattern.
Few-Shot CoT Example
Q: A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there?
A: Let's think step by step. There are 16 balls in total. Half of them are golf balls, so there are 16 / 2 = 8 golf balls. Half of the golf balls are blue, so there are 8 / 2 = 4 blue golf balls.
Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?

Key Takeaways from Lecture 10
- Chain-of-Thought (CoT) Prompting asks the AI to explain its reasoning process.
- It is most useful for logic, math, and multi-step problems.
- It works by breaking a large problem into smaller, more manageable steps.
- You can trigger it easily with phrases like “Let’s think step by step.” (Zero-Shot CoT).
- For more control, you can provide a full example of step-by-step reasoning (Few-Shot CoT).
End of Lecture 10. This is a big step into advanced prompting! Next, we’ll switch gears and look at how to use prompts for creative tasks like writing stories and poems.