Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I already asked a question (Order of operations in rotation matrix notation.) about the order in which a particular equation is "processed" and now I need to generalise that and learn the rules of math notation. I can't find this sort of 'documentation' in any of my books or on the web.

In the "construction" equation in J.M.'s answer to Matrix for rotation around a vector, in what order does the equation get 'processed'?

Commentators on my first question seemed doubtful as to the ambiguity in mathematical notation that I seem to be experiencing and that parentheses are commonplace, yet I rarely see them used to denote processing priority, so its obviously implied (which is no good for the unwashed).

The main problem I have is that the sine function has a power-of 2 right after it, which throws my assumption that the very next symbol is what should be fed into the function.

Even though I've been programming since I was 8, I'm finding math almost as hard-going as anyone else and I feel that it is the symbolic compressive encryption system that's the problem.

Anyway, can anyone recommend a primer on reading math, rather like a programming language specification?

Luke

share|improve this question
3  
A grammatical note: you should refer to these as mathematical expressions, rather than equations. An equation requires an equals sign, i.e. $6/2=3$, whereas an expression is more like a mathematical "phrase," which I think is what you're interested in. –  Alexander Gruber Mar 12 '13 at 21:04
add comment

3 Answers

up vote 6 down vote accepted

You are exactly right that the expression in J.M.'s (original) answer contains ambiguity. Mathematicians can distinguish the correct meaning easily because we are used to seeing things written this way, but it can be difficult for the uninitiated. Let me break it down for you.

$$\mathbf I+\sin\,\varphi\mathbf W+2\sin^2\frac{\varphi}{2}\mathbf W^2$$

  1. To begin with, often when people do linear algebra (arithmetic with matrices and vectors), they will bold the symbol for a matrix (an array) or a vector (a tuple) to distinguish it from a scalar (a number). In this case, J.M. was distinguishing that I and W are matrices. (Conventionally capital bolded letters like ${\bf A}$ denote matrices, while lower case bolded letters like ${\bf v}$ denote vectors.) In particular, I refers to the identity matrix, which is the matrix with diagonal entries $1$ and all other entries $0$. Sometimes we write this as ${\bf I_n}$ instead to distinguish the dimensions of that particular matrix. $$\mathbf{I}_n =\underbrace{\left.\left(\begin{array}{ccccc}1&0&0&\cdots &0\\0&1&0&\cdots &0\\0&0&1&\cdots &0\\ \vdots&&&\ddots &\\0&0&0&\cdots &1\end{array}\right)\right\}}_{n\text{ columns}}\,n\text{ rows}$$

  2. As you learned in the last post, $\sin$ is a trigonometric function. Generally we write $\sin(\theta)$ to denote the $\sin$ of $\theta$, but we sometimes leave the parenthesis out when we believe the meaning is unambiguous. $\sin\varphi {\bf W}$ appears ambiguous because you don't know whether you should be $\sin$'ing $\varphi$ or $\varphi{\bf W}$. However, you can't $\sin$ a matrix, so now that you know the convention that matrices are bolded, it should be clear that $\sin{\varphi}{\bf W}$ denotes a scalar $\sin(\varphi)$ multiplied by a matrix ${\bf W}$. A scalar multiplied by a matrix is simply the scalar applied to each entry in the matrix, so $$\begin{eqnarray*}\sin\varphi {\bf W}&=&\sin\varphi \left(\begin{array}{ccc} W_{11} & W_{12} & \cdots & W_{1n} \\ W_{21} & W_{22} & \cdots & W_{2n} \\ \vdots & & \ddots & \\ W_{m1} & W_{m2} & \cdots & W_{mn} \end{array}\right)\\&=&\left(\begin{array}{ccc}\sin(\varphi) W_{11} &\sin(\varphi) W_{12} & \cdots & \sin(\varphi) W_{1n} \\ \sin(\varphi) W_{21} &\sin(\varphi) W_{22} & \cdots & \sin(\varphi) W_{2n} \\ \vdots & & \ddots & \\\sin(\varphi) W_{m1} & \sin(\varphi) W_{m2} & \cdots & \sin(\varphi)W_{mn} \end{array}\right).\end{eqnarray*}$$

  3. There is another weird notation here. $\sin^2\theta$, for whatever reason, is how we write $(\sin(\theta))^2$. (I honestly don't know how this originated. Usually when you have a function $f$ and you write $f^2(x)$, it means $f(f(x))$, not $(f(x))^2$, but for trigonometric functions this is different.) So in the expression $2\sin^2\frac{\varphi}{2}{\bf W^2}$, you would first evaluate the scalar $2\sin^2\frac{\varphi}{2}$: first divide $\varphi$ by $2$, then compute the $\sin$, then square it, then multiply by $2$. Set the result aside (let's call it $\alpha$), compute ${\bf W}^2={\bf W}\cdot{\bf W}$ with matrix multiplication, and then multiply each entry of ${\bf W}^2$ by $\alpha$ term by term.

  4. The very last thing you do is add the three matrices $I$, $\sin\varphi {\bf W}$, and $2\sin^2\frac{\varphi}{2}{\bf W}^2$ together. Addition of matrices is simply term by term, i.e. $$A+B=\left(\begin{array}{ccc} A_{11} & A_{12} & \cdots & A_{1n} \\ A_{21} & A_{22} & \cdots & A_{2n} \\ \vdots & & \ddots & \\ A_{m1} & A_{m2} & \cdots & A_{mn} \end{array}\right)+\left(\begin{array}{ccc} B_{11} & B_{12} & \cdots & B_{1n} \\ B_{21} & B_{22} & \cdots & B_{2n} \\ \vdots & & \ddots & \\ B_{m1} & B_{m2} & \cdots & B_{mn} \end{array}\right)=\left(\begin{array}{ccc} A_{11}+B_{11} & A_{12}+B_{12} & \cdots & A_{1n}+B_{1n} \\ A_{21}+B_{21} & A_{22}+B_{22} & \cdots &A_{2n}+ B_{2n} \\ \vdots & & \ddots & \\ A_{m1}+B_{m1} &A_{m2}+ B_{m2} & \cdots & A_{mn}+B_{mn} \end{array}\right).$$ Note that $A+B$ is only defined when $A$ and $B$ have the same dimensions - if $A$ is an $m\times n$ matrix, $B$ has to be too.

Hope this helps! It may help to compute a small example (with $2\times 2$ matrices) with pen and paper.

share|improve this answer
    
:-) Being a mathematician can't help but comment, "you can't sin a matrix" is false at least for square matrices. You can take powers of square matrices which means they can be easily plugged into sine's Taylor series which will converge, just like how you can exponentiate a square matrix. –  Fixed Point Mar 13 '13 at 7:06
    
Another interpretation, in the spirit of MATLAB, is element-wise operation which works for any size matrix. Sine of a matrix is the matrix of the sines. You just take sine of each element...jus sayin' –  Fixed Point Mar 13 '13 at 7:09
    
@Alexander - Once again, you shine a bright light into the room. I must say that in programming we go to great lengths to make our code highly readable, often like prose. I wonder if code would be a more accessible tool to teach math than the traditional notation, at least up to a point. Same problems to solve with the same logic, different syntax, plus they can test it immediately in 'cool' projects. –  Luke Puplett Mar 13 '13 at 8:00
    
As @Fixed Point notes, one can indeed take the sine of a matrix. On the other hand, I've decided to edit my original answer so that the less-nuanced are not tripped up... –  J. M. Mar 23 '13 at 13:26
    
@J.M. Alright alright, I omitted the $\sin$ of a matrix thing because I thought it would reduce confusion for the OP. It is technically true that one can $\sin$ a matrix, but that is not what we're doing in this context. It's not like we're taking the $\sin$ of the matrix $\varphi\mathbf{W}$. –  Alexander Gruber Mar 25 '13 at 20:14
show 1 more comment

There are many conventions here which need to be learned. Parentheses override anything. Horizontal fraction bars (but not diagonal ones) come with parentheses around the stuff above and below them. Then exponents come before multiplication/division, which come before addition/subtraction. We just got (again) the question of how to parse $6/2(1+2)$ which computers know is $9$ but many people think is $1$ and we see similar forms with both intents.

The particular form you reference $2 \sin^2 \frac \varphi 2$ is special. Because trigonometry functions often need squaring we write them this way instead of $2(\sin \frac \varphi 2)^2$, which is equivalent. Aside from trigonometry, you rarely see $f^2(x)$ and if you do, it is sometimes the square of $f(x)$ and sometimes $f(f(x))$-the author owes you an explanation. Usually only one of these makes sense. Another trouble is arguments of trigonometry functions-we sometimes write $\sin x$ without parentheses, but is $\sin 2 \pi \omega t$ supposed to be $\sin (2) \pi \omega t$ or $\sin (2\pi \omega t)$? I would bet heavily on the latter.

share|improve this answer
    
If I had meant $\sin(2) \pi \omega t$ I would have written $\pi \omega t \sin 2$, not $\sin 2 \pi \omega t$. And the correct way to write $6\over2(1+2)$ inline is $6/2 {\color{Red} /} (1+2)$. –  AJMansfield Mar 12 '13 at 21:56
1  
@AJMansfield: That could very well be interpreted as $6/(2/(1+2))$. The only unambiguous way is to use parentheses. –  Javier Badia Mar 12 '13 at 22:08
    
@AJMansfield: I was just giving examples of problems that I have seen. Each has ways of being made clear, but not everybody does. I also remember recently seeing $1/2x$ which I would guess is $\frac 1{2x}$ and $1/2\sin x$ which I would guess is $\frac 12 \sin x$ –  Ross Millikan Mar 12 '13 at 22:10
    
But the fact is that those who write it $ft/s/s$ are superior to those who write it $ft/s^2$, because there is no such thing as a square second. –  AJMansfield Mar 12 '13 at 22:11
    
But the basic fact is that you should look at their handwriting. Most people, even if unconsciously, will shift their line a little bit down for the part that should go on the bottom of the fraction. –  AJMansfield Mar 12 '13 at 22:14
add comment

The basic answer is that trig functions are special. Other than those, math symbols usually behave pretty much the same way. I personally almost always mean $f(x)^2$ when I write $f^2(x)$, and I have a bunch of other conventions I use to ensure that I understand my notes, but as long as you get to the right answer, most teachers either don't care precisely what notation you use to get the answer, as long as the end result is in the notation they use. Those who do care usually don't mind a few extra sets of parentheses.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.