ExplainOwl Library

Polish notation

🌍 Languages & OtherSimple🌐 English~1 min▶ Video
▶ Watch it taught live Opens the whiteboard: the tutor draws and talks through this lesson, and you can ask questions.

Transcript

What if maths never needed brackets at all?

Just to go explain notation.
AI illustration (FLUX.2 on Cloudflare)

Normally we write the operator in the middle, like three plus four. That is called infix notation.

Everyday sums
Everyday sums · AI illustration (FLUX.2 on Cloudflare)
Operator in the middle
Operator in the middle · Photo: Zulfugar Karimov / Pexels
3 + 4

In Polish notation, the operator goes first. Plus, three, four. The operator comes before the numbers.

+\ 3\ 4
Diagram Operator → Three → Four

A logician named Jan Łukasiewicz invented it in 1924. He was Polish, so it is called Polish notation.

  • Invented in 1924
Jan Łukasiewicz
Jan Łukasiewicz · Wikipedia: Jan Łukasiewicz

It has other names too, like prefix notation, because the operator comes as a prefix, at the front. Now the clever part. Think about two times, open bracket, three plus four, close bracket. Brackets tell us what to do first.

2 \times (3 + 4)
Brackets group things
Brackets group things · AI illustration (FLUX.2 on Cloudflare)
Too many brackets!
Too many brackets! · Photo: Andrea Piacquadio / Pexels

In Polish notation, the same thing is times, two, plus, three, four. No brackets needed at all.

  • No brackets needed!
\times\ 2\ +\ 3\ 4

Why does it work? Each operator takes a fixed number of numbers, so there is only one way to read it.

Diagram times · 2 · plus · 3 · 4

Let us read it like a computer. Start from the right and work backwards. First, plus three four makes seven.

+\ 3\ 4 = 7

Now the expression is times two seven. Two times seven makes fourteen. That is the answer.

\times\ 2\ 7 = 14

Computers love this because the tree is easy to build. The programming language Lisp writes everything this way.

  • Lisp uses prefix style
Easy for computers
Easy for computers · AI illustration (FLUX.2 on Cloudflare)
Read left to right
Read left to right · AI illustration (FLUX.2 on Cloudflare)

There is also reverse Polish notation, where the operator comes last. Three, four, plus.

Diagram Three → Four → Plus
3\ 4\ +

Compare all three. Infix has the operator in the middle, prefix at the front, and postfix at the end. Quick check. How would you write four minus one in Polish notation? So, Polish notation puts the operator first, which removes brackets and makes expressions easy for computers to read.

Quick quiz

Q1. Four minus one in Polish notation is...

More in Languages & Other

All Languages & Other lessons →