ArticleslgStudy

mathematics

Polish notation

Polish notation is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Polish notation rather than just read about it. In short: Polish notation (PN), also known as normal Polish notation (NPN), Łukasiewicz notation, Warsaw notation, Polish prefix notation, Eastern Notation, or simply prefix notation, is a mathematical notation in which operators precede their operands, in contrast to the more common infix notation, in which operators are placed between operands, as well as reverse Polish notation (RPN), in which operators follow their operan…

Polish notation — main illustration
Polish notation — illustration

Key takeaways

  • Polish notation belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Polish notation to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Polish notation from memory before moving on to harder problems.

Reference excerpt

Polish notation (PN), also known as normal Polish notation (NPN), Łukasiewicz notation, Warsaw notation, Polish prefix notation, Eastern Notation, or simply prefix notation, is a mathematical notation in which operators precede their operands, in contrast to the more common infix notation, in which operators are placed between operands, as well as reverse Polish notation (RPN), in which operators follow their operands. It does not need any parentheses as long as each operator has a fixed number of operands. The description "Polish" refers to the nationality of logician Jan Łukasiewicz, who invented Polish notation in 1924. Sometimes the term Polish notation refers collectively to normal Polish notation and reverse Polish notation (prefix notation and postfix notation, the two alternatives to infix notation). When Polish notation is used as a syntax for mathematical expressions by programming language interpreters it is readily parsed into abstract syntax trees and can, in fact, define a one-to-one representation for the same. Because of this, Lisp (see Implementations, below) and related programming languages define their entire syntax in prefix notation (and others use postfix notation).

History A quotation from a paper by Jan Łukasiewicz in 1931 states how the notation was invented:

I came upon the idea of a parenthesis-free notation in 1924. I used that notation for the first time in my article Łukasiewicz (1), p. 610, footnote. The reference cited by Łukasiewicz, i.e., Łukasiewicz (1), is apparently a lithographed report in Polish. The referring paper by Łukasiewicz was reviewed by Henry A. Pogorzelski in the Journal of Symbolic Logic in 1965. Heinrich Behmann, editor in 1924 of the article of Moses Schönfinkel, already had the idea of eliminating parentheses in logic formulas. In one of his papers Łukasiewicz stated that his notation is the most compact and the first linearly written parentheses-free notation, but not the first one as Gottlob Frege had proposed his parentheses-free Begriffsschrift notation in 1879 already. Alonzo Church mentions this notation in his classic book on mathematical logic as worthy of remark in notational systems even contrasted to Alfred Whitehead and Bertrand Russell's logical notational exposition and work in Principia Mathematica. In Łukasiewicz's 1951 book, Aristotle's Syllogistic from the Standpoint of Modern Formal Logic, he mentions that the principle of his notation was to write the functors before the arguments to avoid brackets and that he had employed his notation in his logical papers since 1929. He then goes on to cite, as an example, a 1930 paper he wrote with Alfred Tarski on the sentential calculus. While no longer used much in logic, Polish notation has since found a place in computer science.

Explanation The expression for adding the numbers 1 and 2 is written in Polish notation as + 1 2 (prefix), rather than as 1 + 2 (infix). In more complex expressions, the operators still precede their operands, but the operands may themselves be expressions including again operators and their operands. For instance, the expression that would be written in conventional infix notation as

can be written in Polish notation as

Assuming a given arity of all involved operators (here the "−" denotes the binary operation of subtraction, not the unary function of sign-change), any well-formed prefix representation is unambiguous, and brackets within the prefix expression are unnecessary. As such, the above expression can be further simplified to

The processing of the product is deferred until its two operands are available (i.e., 5 minus 6, and 7). As with any notation, the innermost expressions are evaluated first, but in Polish notation this "innermost-ness" can be conveyed by the sequence of operators and operands rather than by bracketing. In the conventional infix notation, parentheses are required to override the standard precedence rules, since, referring to the above example, moving them

or removing them

changes the meaning and the result of the expression. This version is written in Polish notation as

When dealing with non-commutative operations, like division or subtraction, it is necessary to coordinate the sequential arrangement of the operands with the definition of how the operator takes its arguments, i.e., from left to right. For example, ÷ 10 5, with 10 to the left of 5, has the meaning of 10 ÷ 5 (read as "divide 10 by 5"), or − 7 6, with 7 left to 6, has the meaning of 7 − 6 (read as "subtract from 7 the operand 6").

Evaluation algorithm Prefix/postfix notation is especially popular for its innate ability to express the intended order of operations without the need for parentheses and other precedence rules, as are usually employed with infix notation. Instead, the notation unambiguously indicates which operator to evaluate first. The operators are assumed to have a fixed arity each, and all necessary operands are assumed to be explicitly given. A valid prefix expression always starts with an operator and ends with an operand. Evaluation can either proceed from left to right, or in the opposite direction. Starting at the left, the input string, consisting of tokens denoting operators or operands, is pushed token for token onto a stack, until the top entries of the stack contain the number of operands that fits to the topmost operator (immediately beneath). This group of tokens at the top of the stack (the last stacked operator and its required number of operands) is replaced by the result of applying the operator to its operand(s). The result, itself an operand, may in turn complete the operator beneath it; otherwise, pushing resumes. The rightmost operand in a valid prefix expression thus empties the stack, except for the result of evaluating the whole expression. When starting at the right, the pushing of tokens is performed similarly, just the evaluation is triggered by an operator, finding the appropriate number of operands that fits its arity already at the top of the stack. Now the leftmost token of a valid prefix expression must be an operator, fitting to the number of operands in the stack, which again yields the result. As can be seen from the description, a push-down store with no capability of arbitrary stack inspection suffices to implement this parsing. The above sketched stack manipulation works—with mirrored input—also for expressions in reverse Polish notation.

… excerpt ends here. Continue reading the full article.

Illustrations

Polish notation illustration

Worked examples

Example 1 — a first encounter with Polish notation

Start with the simplest possible case. Write down what Polish notation claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Polish notation before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Polish notation ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Polish notation

In research
Polish notation appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Polish notation in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Polish notation is common in secondary-school and first-year university syllabi. It links to neighbouring topics Logical expressions, Mathematical notation, Operators (programming), so understanding it makes those chapters shorter.
In everyday life
Look for Polish notation outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Polish notation” →

How to study Polish notation in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Polish notation means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Polish notation out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Polish notation in simple terms?

Polish notation (PN), also known as normal Polish notation (NPN), Łukasiewicz notation, Warsaw notation, Polish prefix notation, Eastern Notation, or simply prefix notation, is a mathematical notation in which operators precede their operands, in contrast to the more common infix notation, in which…

Why does Polish notation matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Polish notation?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Polish notation.

Tags

  • Logical expressions
  • Mathematical notation
  • Operators (programming)
  • Polish inventions
  • Science and technology in Poland

Keep exploring