# Syntax Trees in Mathematicians’ Brains

In my last post I wrote about how a student’s pattern recognition mechanism can go awry in applying the quadratic formula.

The template for the quadratic formula says that the solution of a quadratic equation of the form ${ax^2+bx+c=0}$ is given by the formula

$\displaystyle x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$

When you ask students to solve ${a+bx+cx^2=0}$ some may write

$\displaystyle x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$

$\displaystyle x=\frac{-b\pm\sqrt{b^2-4ac}}{2c}$

That’s because they have memorized the template in terms of the letters ${a}$, ${b}$ and ${c}$ instead of in terms of their structural meaning — ${a}$ is the coefficient of the quadratic term, ${c}$ is the constant term, etc.

The problem occurs because there is a clash between the occurrences of the letters “a”, “b”, and “c” in the template and in the equation to solve. But maybe the confusion would occur anyway, just because of the ordering of the coefficients. As I asked in the previous post, what happens if students are asked to solve ${3+5x+2x^2=0}$ after having learned the quadratic formula in terms of ${ax^2+bx+c=0}$? Some may make the same kind of mistake, getting ${x=-1}$ and ${x=-\frac{2}{3}}$ instead of ${x=-1}$ and ${x=-\frac{3}{2}}$. Has anyone ever investigated this sort of thing?

People do pattern recognition remarkably well, but how they do it is mysterious. Just as mistakes in speech may give the linguist a clue as to how the brain processes language, students’ mistakes may tell us something about how pattern recognition works in parsing symbolic statements as well as perhaps suggesting ways to teach them the correct understanding of the quadratic formula.

Syntactic Structure

“Structural meaning” refers to the syntactic structure of a mathematical expression such as ${3+5x+2x^2}$. It can be represented as a tree:

(1)

This is more or less the way a program compiler or interpreter for some language would represent the polynomial. I believe it corresponds pretty well to the organization of the quadratic-polynomial parser in a mathematician’s brain. This is not surprising: The compiler writer would have to have in mind the correct understanding of how polynomials are evaluated in order to write a correct compiler.

Linguists represent English sentences with syntax trees, too. This is a deep and complicated subject, but the kind of tree they would use to represent a sentence such as “My cousin saw a large ship” would look like this:

### Parsing by mathematicians

Presumably a mathematician has constructed a parser that builds a structure in their brain corresponding to a quadratic polynomial using the same mechanisms that as a child they learned to parse sentences in their native language. The mathematician learned this mostly unconsciously, just as a child learns a language. In any case it shouldn’t be surprising that the mathematicians’s syntax tree for the polynomial is similar to the compiler’s.

Students who are not yet skilled in algebra have presumably constructed incorrect syntax trees, just as young children do for their native language.

Lots of theoretical work has been done on human parsing of natural language. Parsing mathematical symbolism to be compiled into a computer program is well understood. You can get a start on both of these by reading the Wikipedia articles on parsing and on syntax trees.

There are papers on students’ misunderstandings of mathematical notation. Two articles I recently turned up in a Google search are:

Both of these papers talk specifically about the syntax of mathematical expressions. I know I have read other such papers in the past, as well.

What I have not found is any study of how the trained mathematician parses mathematical expression.

For one thing, for my parsing of the expression ${3+5x+2x^2}$, the branching is wrong in (1). I think of ${3+5x+2x^2}$ as “Take 3 and add ${5x}$ to it and then add ${2x^2}$ to that”, which would require the shape of the tree to be like this:

I am saying this from introspection, which is dangerous!

Of course, a compiler may group it that way, too, although my dim recollection of the little bit I understand about compilers is that they tend to group it as in (1) because they read the expression from left to right.

This difference in compiling is well-understood.  Another difference is that the expression could be compiled using addition as an operator on a list, in this case a list of length 3.  I don’t visualize quadratics that way but I certainly understand that it is equivalent to the tree in Diagram (1).  Maybe some mathematicians do think that way.

But these observations indicate what might be learned about mathematicians’ understanding of mathematical expressions if linguists and mathematicians got together to study human parsing of expressions by trained mathematicians.

Some educational constructivists argue against the idea that there is only one correct way to understand a mathematical expression.  To have many metaphors for thinking about math is great, but I believe we want uniformity of understanding of the symbolism, at least in the narrow sense of parsing, so that we can communicate dependably.  It would be really neat if we discovered deep differences in parsing among mathematicians.  It would also be neat if we discovered that mathematicians parsed in generally the same way!

Send to Kindle

## 11 thoughts on “Syntax Trees in Mathematicians’ Brains”

1. Avery Andrews says:

One random thought is that in many cases, left-branching, right-branching and ‘flat’ (n-ary operator) parsings would be provably equivalent in whatever they denote.

One would think that the left-branching structures would be easy to process, due having to hold less unintegrated semantic values than the right-branching ones, but people don’t seem to have that much trouble with things like ‘I thought he thought that I thought …’ so people seem to be able to employ optimizations. ‘categorial’ and ‘type logical’ grammarians know a lot about this kind of stuff (and tend to know more math than other kinds of linguists)

2. Charles Wells says:

I am sure that the three types of parsing are equivalent. But what I am interested in is the way mathematicians and students think. The details of how the structure is organized in the brain is different for the three parsings, and they probably have different memory requirements just as they do for program language parsing.

3. Avery Andrews says:

Sure, but the equivalences and general obscurity of the relationship between diagrams and events in the brain make it impossible to really show that the structure is one thing rather than another. Forex, categorial grammarians can show how to process the grammar producing the first tree as if it was producing the second, using the ‘Geach Rule’ to compose functions, and then applying the result to the right-most daughter. But mathematicalese as a natural language certainly is a really interesting topic, whatever the right way of investigating it turns out to be.

4. Interesting idea. As a mathematician, I’d argue that there are several different parsing mechanisms that a mathematician might use to understand a mathematical object (like a quadratic function), and the flexibility and choice in using them is key. For example, if I see 3+5x+2x^2, I might have some kind of syntactical deep structure tree in my head, but just as likely, I might think “parabola.” Or I might think: degree 2 curve. Or: polynomial with integer coefficients. It’s the meta-skill of choosing what lens to use that’s the most crucial for mathematicians (though knowing how to use them is nice too).

So the student to just applies the quadratic formula (perhaps incorrectly) is the most inflexible kind of thinker, and we’ve essentially taught them to be inflexible. I once taught a class where we solved the quadratic x^2=x+1, to find one of the solutions is the golden mean. Then I had students square the golden mean. Their calculators said something like:
1.618… squared equals 2.618…

They were shocked. What an amazing property of this number that you can square it and it’s just like adding one! Of course, solving the equation x^2=x+1, means that you need a number with precisely this property! But I think the syntactical understanding takes a long time to develop, and follows raw mathematical knowledge.

5. jk says:

No, no.
I am a mathematician and I do not “parse” and certainly not into a “tree”. Besides reading (which is indeed complicated and I do not wish to comment it here), I’m probably scanning. Your picture above is a graph, probably a tree; yes, indeed a tree, well until the scanning reaches the right-hand side where some nodes are missing (perhaps fault of my browser).
4 + x + x x exp a + 4 x is an expression with some letters (variables), well, its a sum (This is because I learned addition has lowest precedence. Actually, logical junctions have even lower, but there are none here. {I forgot relations this time, I can do mistakes}), perhaps sum of products. If I wish to have a polynomial or quadratics, yes it seems to, and I scan and create a statistics: what variables, what powers, anything else? Variables x and a, can ‘a’ be a ‘constant’ ? And oops, ‘exp’ are probably not letters but a word, and ‘exp a’ is not a product but rather evaluation of function. Never mind, looks like a quadratics. Need to be sure? Ok, lets _think_ if it matches Ax^2 + Bx +C.

Large expressions are usually (in)equalities or sums of SOMETHING. Those Somethings are often integrals, evaluations or products of somethings. Those usually consist of (just making a statistics) letters – functions, variables, constants – numbers and exceptionally something more.
After full scan this might become a lot of nested things and
you might decide to interpret that as a tree, but this is your tree. Did you know that the set theory universe is a tree?

If I realize it ‘is’ a ‘quadratics’, then it is a quadratics, with certain A, B, C, that I _can_, with some effort, find out.
I can, don’t have to. Above, C=4 (trivial), B=5 (for that I scanned the expression again).

I said above “if it matches Ax^2 + Bx +C”. That is different from parsing. Think about Prolog programming language semantics. Add numerous ‘identities’, like: a+b=b+a, 4+1=5, 8 is a number. Or at least think about the most complicated Regular Expression you ever dreamed about.
And add a lot of other. Is x^3/x a quadratics? It depends.
Is x^2/c a quadratics? Got’a, it depends. Is F^3 a quadratics? It depends, for example if F(x)=… .

What is parsing? For me (and I am not well educated in that direction) it is the process of changing the state of a machine by flowing input data text.
This might describe reading. But for expressions, equalities and sometimes theorems, I do partial scan and/or skip.
Might it be is easier to think whats there then to look?
First after I cannot guess, I have a reason to undergo labour.

6. I do not “parse” and certainly not into a “tree”

… and then proceeding to parse the expression.

A query of Wikipedia (taking less than a second) comes up with

parsing is the process of analyzing a text made of a sequence of tokens to determine its grammatical structure with respect to a given (more or less) formal grammar.

So, even just saying “it’s a sum” is parsing.

7. Artyom Shalkhakov says:

Thanks for the article.

Interestingly, (1) looks like an output of an LL (or any recursive descent, top-down) parser, whereas (2) is more of a result of bottom-up parsing. Terms like (2) are derivations of left-recursive grammars (note that the term is of the form (a + b) + c) — left-associative).

So perhaps you use bottom-up parsing? 🙂

8. My brother recommended I might like this blog. He was totally right. This post actually made my day. You cann’t imagine simply how much time I had spent for this information! Thanks!

9. As soon as I at first left a comment I clicked on the Notify me any time new comments are added checkbox and currently each time a comment is added I receive four email messages with the same comment.

1. SixWingedSeraph says:

I will investigate.  –Charles