Cleve’s Corner: Cleve Moler on Mathematics and Computing

Backslash 4

Posted by Cleve Moler,

The backslash operator has come to represent both the matrix origins and the usability of MATLAB.

Contents

T-shirts

At the recent SIAM Annual Meeting in San Diego we offered T-shirts at the MathWorks booth that featured the iconic MATLAB statement

x = A\b;

They prompted a friend to ask me "When you were developing MATLAB, how did you come to choose the backslash character for the solution of linear equations." The answer takes us back to the beginnings because solving linear equations is certainly the first nontrivial operation MATLAB had to be able to do.

Father of ASCII

Robert W. (Bob) Bemer was an early computer pioneer at Rand Corporation and at IBM who was a prominent participant in industry standards committees. Among his many accomplishments, he was one of the first people to propose an approach to the Y2K problem. His 1960 design of the character set for the IBM STRETCH computer included the backslash, as well as curly braces and square brackets. He later added the escape character.

Bemer was an advocate of the backslash character because it could be combined with the forward slash to form the logic operators /\ and \/, which were part of the ALGOL 60 programming language. In the early 1960s, Bemer was instrumental in having backslash, as well as the braces, brackets, and escape, included in the American Standard Code for Information Interchange character set. That's ASCII for short and is, of course, is the character set that all computers use today.

When Bemer proposed backslash to the ASCII committee, there was not immediate acceptance. But he says, "So I asked for a character more important to have. After much discussion they could not agree on a better candidate."

BCD and EBCDIC

It took more than a decade for the ASCII character set to be universally adopted. In the mid to late 1970s we still had to deal with computers and computer terminals that had different character sets. Many central main frames had operating systems with 6-bit character sets and so could not handle both upper and lower case. Different machines had different sets of special characters.

The IBM main frames at Argonne National Laboratory, where we were working on EISPACK and LINPACK, initially had a 6-bit, upper case only character set called BCD, for Binary Coded Decimal. New machines brought with them 8-bit EBCDIC, which had upper and lower case and was a kind of transition from BCD to ASCII. Other big machines from other manufacturers, at other national laboratories and at university computer centers, had other operating systems and other character sets. It was a veritable zoo.

Choosing backslash

But, perhaps surprisingly, all these systems happened to have one thing in common -- they all included backslash among their collection of special characters. Thinking about it now as I write this blog, I can only surmise that it was because of Bob Bemer and in anticipation of the emerging ASCII standard.

Since matrix multiplication is not commutative, solving the linear system $Ax = b$ is not the same thing as solving $xA = b$. I needed two different symbols for the two different solution operations. You can think of the process as like dividing by $A$, so it was just natural to choose the backward slash and the forward slash for the two symbols. This gives us the two different MATLAB statements

x = A\b;

x = b/A;

The first of these is by far the more important.

Kurt Hensel, 1928

Nick Higham somehow found a paper written in 1928 by a famous German mathematician, Kurt Hensel, "Uber den Zusammenhang zwischen den Systemen und ihren Determinanten". Hensel introduces the backslash notation for the solution of a system of simultaneous linear equations in the same way we have, in fact with the same letters, $A$, $X$, and $B$. He then uses the notation once on the fourth page of the paper and never again. As the title indicates, most of the paper is about determinants.

As far as we know, no one else used backslash in this way until I did fifty years later.

19th Century notation

Nick also describes notation devised in the 19th century, before matrices were called matrices. Nick found that Arthur Cayley suggested

$$ \frac{B |}{| A} \ \ \mbox{and} \ \ \frac{| B}{A |} $$

for $BA^{-1}$ and $A^{-1}B$ in the context of groups. Fortunately, this notation did not catch on.

Acknowledgement

Thanks to Nick Higham for help with this week's post.

Further Reading

R. M. Bemer, "How ASCII Got Its Backslash", <http://www.trailing-edge.com/~bobbemer/BACSLASH.HTM>

K. Hensel, "Uber den Zusammenhang zwischen den Systemen und ihren Determinanten", Journal fur die reine und angewandte Mathematik (Crelle's Journal). 1928, volume 159, Pages 246-254. <http://resolver.sub.uni-goettingen.de/purl?PPN243919689_0159/dmdlog27>

N. J. Higham, "Cayley, Sylvester, and early matrix theory", Linear Algebra Appl., 428:39-43, 2008. <http://eprints.ma.man.ac.uk/954/01/covered/MIMS_ep2007_119.pdf>


Get the MATLAB code

Published with MATLAB® R2013b

4 CommentsOldest to Newest

It’s amazing how much numerical linear algebra is contains in that single character.

My favorite reference for backslash is Section 8.5 of Tim Davis’ Direct Methods for Sparse Linear Systems. He lays out the 11 different steps mldivide follows to determine the properties of A and thus which algorithm to use. It’s a must read!

Also, I would kill for one of those shirts!

I agree that the T-shirt is highly desirable.

Is matrix division taught these days in linear algebra? Back when I was a student, I was told to calculate the inverse of A*transpose(A) (outside of MATLAB) in situations where I would now use the backslash operator. In addition to the numerical benefits, I think the backslash is more intuitive.

No, the backslash notation has not found its way beyond the MATLAB community. I must say that linear algebra courses are still often about “linear algebra” in the strict sense, that is axioms and proofs of theorems about vector spaces.

Any time I’ve taught computations and linear algebra, I’ve emphasized the utility and simplicity of the backslash. A wonderful amount of work rolled into a simple symbol. It just takes a bit of practice to use it – effectively and correctly.

Great shirt. Maybe you could add the sub-line “You don’t have to be square to use it.”?

These postings are the author's and don't necessarily represent the opinions of MathWorks.