On this page
Brackets decide everything in school maths: (2 + 3) × 4 is 20, while 2 + 3 × 4 is 14. A century ago a Polish logician found a way to write formulas with no brackets at all, and the idea later went into early computing and into calculators.
Who was Jan Łukasiewicz?
Jan Łukasiewicz was a Polish logician, born in Lwów on 21 December 1878, who died in Dublin on 13 February 1956, according to the Stanford Encyclopedia of Philosophy. He became a professor at the University of Warsaw in 1915, served as Poland's Minister of Education in 1919 and was twice rector of the university. After the Second World War he became professor of mathematical logic at the Royal Irish Academy in Dublin.
What is Polish notation and why does it need no brackets?
Polish notation, also called prefix notation, writes every operator before the things it acts on. The Stanford Encyclopedia's note on Polish notation says Łukasiewicz invented it in 1924, and that in it "all functors (connectives) are written before their arguments", each connective is a capital letter, and each takes a fixed number of arguments.
His letters were N for "not", K for "and", A for "or", C for "if ... then" and E for "if and only if". So CpCqr means "if p, then (if q, then r)", while CCpqr means "(if p, then q), then r". The order of the letters does the job brackets used to do.
The fixed number of inputs is what makes it work. C always takes exactly two things, so when you read C you collect the next two complete formulas, and there is only one way to read the string. The same Stanford note gives a formula that needs 43 symbols in ordinary notation, 20 of them brackets, and only 23 symbols in Polish notation.
In arithmetic, 3 + 4 becomes + 3 4, and (3 + 4) × 5 becomes × + 3 4 5.
How do you convert a formula to Polish notation?
Take (2 + 3) × (7 − 4), which equals 15.
Find the operator done last. Here it is ×, joining (2 + 3) and (7 − 4).
For prefix, write that operator first, then the left part, then the right part: × [2 + 3] [7 − 4].
Repeat inside each part: + 2 3 and − 7 4.
Join them: × + 2 3 − 7 4.
For postfix, put each operator after its two parts instead: 2 3 + 7 4 − ×.
Check your answer. In prefix, every operator must be followed by exactly two complete pieces. With two-input operators, there is always one more number than operators: here 4 numbers and 3 operators.
Watch subtraction and division: − 7 4 means 7 − 4, not 4 − 7. The numbers keep their order; only the operators move.
Why do reverse Polish calculators use a stack?
Reverse Polish notation can be read left to right with one simple memory, a stack: a pile where you can only add to or take from the top. The rule has two lines:
See a number: push it on top.
See an operator: take off the top two numbers, apply the operator, push the result.
Trace 2 3 + 7 4 − ×:
2: stack is 2
3: stack is 2, 3
+: take 3 and 2, push 5
7: stack is 5, 7
4: stack is 5, 7, 4
−: take 4 and 7, push 7 − 4 = 3; stack is 5, 3
×: take 3 and 5, push 15
There are no brackets to match and no need to look ahead, and early computer scientists studied bracket-free notation too. In 1954 Arthur Burks, Don Warren and Jesse Wright published an analysis of a logical machine using parenthesis-free notation, and in 1962 Charles Hamblin wrote on translating to and from Polish notation in The Computer Journal.
Hewlett-Packard's HP-35 of 1972 was the first handheld calculator to work out trigonometric, logarithmic and exponential functions, and it used an operational stack with reverse "Polish" (Łukasiewicz) notation, according to the IEEE milestone record for the HP-35.
How can you practise prefix and postfix?
Try these, then check each by tracing a stack on paper:
Write 8 − (2 × 3) in postfix. (Answer: 8 2 3 × −, which gives 2.)
Write (8 − 2) × 3 in prefix. (Answer: × − 8 2 3, which gives 18.)
If a conversion goes wrong and you cannot see where, the Fermi Problem Library has a step-by-step solver that explains the reasoning rather than printing an answer.
If ordinary notation still trips you up, see why 8 ÷ 2 × 4 is 16 under BODMAS. Counting the ways brackets can be placed leads to Catalan numbers and balanced brackets, and for another notation story, read how Robert Recorde invented the equals sign.



