Skip to content

1.6 Chain-of-Thought Prompting

Complex reasoning

The task involves multi-step logic, calculations, or analysis where the AI needs to show its working to get the right answer.

Verifiable steps

You want to check each step of the reasoning rather than just trust the final answer.


You provide example questions with step-by-step solutions, then ask your real question. The AI mimics the reasoning pattern.

Provide worked examples so the AI learns the reasoning pattern:

Prompt: Chain-of-thought with examples
Q: There are 15 trees in the grove. Grove workers will plant
trees in the grove today. After they are done, there will be
21 trees. How many trees did the grove workers plant today?
A: There are 15 trees originally. Then there were 21 trees
after some more were planted. So there must have been
21 - 15 = 6. The answer is 6.
Q: If there are 3 cars in the parking lot and 2 more cars
arrive, how many cars are in the parking lot?
A: There are originally 3 cars. 2 more cars arrive.
3 + 2 = 5. The answer is 5.
Q: Leah had 32 chocolates and her sister had 42. If they
ate 35, how many pieces do they have left in total?

The AI responds following the same reasoning pattern:

A: Originally, Leah had 32 chocolates. Her sister had 42.
So in total they had 32 + 42 = 74. After eating 35, they
had 74 - 35 = 39. The answer is 39.

Based on materials from Prompt Engineering Guide.