# Step-by-step reasoningStep-by-step reasoningA prompting technique where a language model is guided to produce intermediate reasoning steps before giving a final answer, improving accuracy on complex tasks.Voir la définition complète → and chain of thought
Ask a model this: "A bat and a ball cost $1.10 total. The bat costs $1.00 more than the ball. How much is the ball?"
Many models blurt out "$0.10." Wrong. The right answer is $0.05.
Now add four words: "Think step by step." Suddenly the model writes out the math, catches its own trap, and lands on $0.05.
That trick has a name: chain of thought. It means asking the model to show its reasoning before giving the final answer. This lesson covers why it works, how to use it, and why some newer models now do it for you.
A large language model (the AI behind ChatGPT, Claude, and Gemini) generates text one piece at a time, predicting the next word based on everything before it.
Here's the key insight: the model can only "think" by writing. It has no scratchpad. When you force it to answer immediately, it has to compress all its reasoning into a single leap. That's where it slips.
When you ask it to work through the steps, each written step becomes context for the next one. The model literally builds its own ladder to the answer.
Think of it like mental math versus writing it on paper. Most people get 17 × 23 wrong in their head and right on paper. Same brain, more room to work. The model is no different.
Chain of thought (often shortened to CoTCoTA prompting technique where a language model is guided to produce intermediate reasoning steps before giving a final answer, improving accuracy on complex tasks.Voir la définition complète →) boosts accuracy on tasks that need actual reasoning:
It does not help much with simple lookups ("What's the capital of France?") or pure creativity. For those, it just adds noise and length.
You don't need anything technical. You're just changing your wording.
Add one of these to your prompt:
Try this in any chatbot:
> A store has 120 apples. They sell 40% in the morning and 25% of the *remaining* apples in the afternoon. How many are left? Think step by step.
The model will lay out: 40% of 120 is 48, leaving 72; 25% of 72 is 18; 72 minus 18 is 54. Clear, checkable, and right.
For tricky or repeated tasks, show the model one example of the reasoning you want. This is called few-shot prompting: you provide a few sample answers to set the pattern.
> Q: Tom has 3 boxes with 4 pens each. He gives away 5 pens. How many are left?
> A: 3 boxes × 4 pens = 12 pens. 12 − 5 = 7. Answer: 7.
>
> Q: Sara has 5 bags with 6 marbles each. She loses 8 marbles. How many are left?
> A:
The model copies your style: it shows the multiplication, then the subtraction, then the answer. You've taught it the format without writing any code.
A practical tip: tell the model to reason first and state the final answer at the end, clearly labeled.
> Solve this. Show each step, then write "FINAL ANSWER:" on its own line.
This makes the result easy to find and easy to verify. You can skim the steps to check the logic, then trust the labeled answer.
For a deeper, plain-language explanation of the research behind this, see Google's write-up on chain-of-thought prompting.
Here's the 2026 reality: you often don't need to type "think step by step" anymore.
A new category of models, called reasoning models or thinking models, does chain of thought on its own, behind the scenes, before answering. They essentially talk to themselves first, then hand you the polished result.
You'll see these as named modes or model picks:
When you use one of these, the interface usually shows a "Thinking..." indicator or a collapsible summary of the reasoning. The model burned extra effort working through the problem before replying.
Use one when the task is genuinely hard: a logic-heavy problem, a multi-step plan, a tricky piece of code, a careful comparison.
Use a regular (faster) model for everyday tasks: rewriting an email, summarizing a doc, brainstorming names. Thinking models are slower and sometimes overkill.
A simple rule: if you'd want a smart human to pause and work it out, pick the thinking model.
If you're on a standard, faster model, "think step by step" still earns you most of the benefit. The phrase isn't dead. It's just built into the premium reasoning modes now.
Vérification des acquis
1. In the classic bat-and-ball problem ($1.10 total, bat costs $1.00 more than the ball), what is the correct price of the ball?
2. According to the lesson, why does writing out steps make a language model more accurate?
3. The lesson mentions that large language models generate text in a particular way. How do they produce their output?
4. Select ALL correct answers. For which kinds of tasks does chain of thought meaningfully boost accuracy?
Sélectionnez toutes les réponses correctes.
5. Select ALL correct answers that accurately reflect claims made in the lesson about chain of thought.
Sélectionnez toutes les réponses correctes.
If you use the APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.Voir la définition complète → (a way to send prompts to a model from a program), chain of thought is just part of your instructions. Here's a short Python example using a simple request:
from openai import OpenAI
client = OpenAI()
prompt = """A train leaves at 2:15 PM and arrives at 4:50 PM.
The return trip takes 20 minutes longer.
What time does the return trip take in total?
Think step by step, then write FINAL ANSWER: on its own line."""
response = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": prompt}]
)
print(response.choices[0].message.content)The model returns the steps (2:15 to 4:50 is 2 hours 35 minutes; plus 20 minutes is 2 hours 55 minutes) and then a clean "FINAL ANSWER:" line you can pull out programmatically.
If you switch to a reasoning model, you often drop the "think step by step" instruction entirely, because the model handles that internally. You just ask the question.
Chain of thought is powerful, not magic. Keep these in mind.
It can reason confidently and still be wrong. Showing steps makes errors visible, but it doesn't guarantee correctness. Always check the logic on anything that matters.
The visible "reasoning" may not be the real reasoning. The steps a model writes are a useful approximation, not a literal transcript of its internal process. Treat them as a sanity check, not gospel.
More steps cost more. Reasoning models use more time and (on the APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.Voir la définition complète →) more money. For trivial questions, that's wasted effort.
Don't force it on creative work. Asking for step-by-step reasoningstep-by-step reasoningA prompting technique where a language model is guided to produce intermediate reasoning steps before giving a final answer, improving accuracy on complex tasks.Voir la définition complète → on "write me a poem" usually makes it stiff and mechanical.
Bad prompt:
> Is 2,310 divisible by 6?
The model might guess.
Good prompt:
> Is 2,310 divisible by 6? A number is divisible by 6 if it's divisible by both 2 and 3. Check each, show your work, then answer.
Now the model checks: it ends in 0, so divisible by 2; its digits sum to 6, which is divisible by 3; therefore yes, divisible by 6. Transparent and correct.
You didn't get smarter. You gave the model room to work.