Double click on the brackets at the right to expand or contract each section.

How to perform a calculation, make comments, and use variables

Type in the math, make sure the cursor is on the line you want to calculate, and then either hit "Shift+"Enter" on the main keyboard, or "Enter" from the small keypad.

1+5

You can type several lines of code or text within the same “cell” (look at the small brackets on the right to see what is connected in one cell). Cells can be nested inside each other (notice on the right that one big cell contains lots of small cells). 
When you evaluate any line within the small cell, it will calculate ALL lines in the small cell, from top to bottom.  
Notice in the following steps that if you only use integers, Mathematica will try to keep it in “exact” form.

1+5
1+5.
18/1.5
Sin[1.5]
Sin[1]

To type comments that are not calculations (like this line), make a text box by hitting "Alt+7" and typing.

2.5+3.3
(* Make comments within a calculation using "(*" and "*)"  like this line. *)
2.5/88

Most of the time, when you use “=” in computations, you should imagine that the computer performs the operation on the right side, then saves it to the variable on the left side.
Capitalization matters: “x” and “X” are not the same variable (this is also true of functions: “sin[t]” is not recognized by Mathematica, but “Sin[t]” does what you expect). Generally Mathematica wants to reserve to itself initial-cap names: N, D, Cos, Integrate...

x=5
X=85
y=2+6
x+y
X+y

Notice that a variable appears in blue if nothing has been saved to it, and then black after it has a value.

variable=9

If you want to clear the value from a particular variable, use “Clear[ ]” (and notice that the name goes back to blue). 
To clear variables for the entire notebook, at the top of the page click “Evaluation” then “Quit Kernel” then “Local” and choose “Quit”.

Clear[variable]

How to make math easier to read

Choosing not to display a result

You can choose not to display the result of a command or intermediate result by adding a semicolon ";" at the end of the line.

a=4
b=2 a
r=b+2

a=4; (* This operation still occurs, but the result is not shown. *)
b=2 a;
r=b+2

Fractions

Hit "Ctrl+/" to make a fraction

14.2/5
(14.2/5)

Exponents

Hit "Ctrl+6" to make an exponent

2^4
(2^4)

Square roots

Hit "Ctrl+2" for a square root symbol

9^(1/2)
(Sqrt[9])

Multiplication

You can multiply two numbers by hitting " * " (really "Shift+8"), or by just hitting the space bar.  But just typing the two numbers back-to-back is not the same as multiplying.

m=2
q=3
m*q
m q
mq

How to make plots of functions

Plot[Sin[2 π t],{t,-1,8}]  (* One function, plotted as a function of t over the range given. *)

Plot[{Sin[2 π y],y Cos[3 π y]},{y,-1,8}]  (* two functions plotted on the same graph. *)

There are a lot of options for Plot[], use the Help menu to learn more.  Commonly used options including changing the vertical range as well as the plot line color, as shown below.  (Make the arrow by typing "-" and then ">", they will turn into the arrow after you type the next character).  Put the options, separated by commas, after the range used in the Plot[] function.

Plot[{Sin[2 π t],t Cos[3 π t]},{t,-1,8},PlotRange->{-8,8}]

Plot[{Sin[2 π t],t Cos[3 π t]},{t,-1,8},PlotRange->{-4,15},PlotStyle->{Red,Blue}]

How to make and display lists

You can make a list of data points by using the curly brackets “{ }” with each number separated by a comma.  You can then choose to display it a few different ways.

list1={3,1,4,1,5,9};   (* Remember that the semicolon means the output won't be displayed. *)
list1  (* Shows the list pretty much just as you typed it. *)
TableForm[list1]  (* Displays the list kind of like a table - we'll see that this is useful later with two dimensional lists. *)
ListPlot[list1] (* Plots the points with evenly spaced x axis and the list values on the y axis. *)

You can make two dimensional lists (or higher dimensions as well), by “nesting” the curly brackets within each other.  Let’s say you have a set of five data points of xy data.

list2={{3,10.1},{4,12},{5.5,16},{6.1,40.5},{7,32.1}};  
list2  (* Show the list. *)
TableForm[list2]  (* Display as a table. *)
ListPlot[list2,PlotRange->{0,50}] (* Plots the data points as (x,y) values like you might expect. Note that "ListPlot[]" uses many of the same options as "Plot[]"*)

You can change one particular value in a list by saving a new value to that specific element.

list1
list1[[4]]=50;
list1

list2
list2[[3,2]]=25;
list2

list3[[2,3]]=23  (* Notice that this doesn't work.  Since list3 has not been created yet, Mathematica can't find a specific element within it.*)

If you want to make a list that has a certain pattern to it, you can often use “Table[ ]”, which steps along from a starting to stopping value in your list. Here are some examples:

Table[i,{i,1,5}] (* Makes a list of values i, starting from 1 and going to 5. *)
Table[2.5*i,{i,4,8}] (* Notice that the index doesn't always have to start at 1. *)
Table[i,{i,0,1,.1}] (* You can also specify a step size between your starting and stopping values - it assumes 1 if you don't specify this. *)

You can use “Table[ ]” to make lists with more than one dimension.

Table[{2*i,0},{i,0,2,.25}]
Table[{i,(i^2)},{i,1,5}]

How to select part of a list

Now lets say you only want to use part of the list - use double square brackets “[[ ]]” to do this.

list1 (* Display list1 to remind us what is in it. *)
list1[[1]]  (* Takes only the first element from list1. *)
list1[[4]] (* Takes only the fourth element from list1. *)

list1[[8]] (* Mathematica gives an error because there is not an eighth element in list1. *)
list1[[0.5]]  (* Another error since there is not a 0.5th element. *)

list1[[3;;6]] (* Using double semicolon in the brackets tells Mathematica you want a new list that is all elements from 3 through 6 from list1. *)
list1[[{3,6}]]  (* Using curly brackets and numbers separated by commas tells Mathematica you want elements 3 and 6 from list1. *)

sublist1=list1[[1;;3]];  (* You can choose to save part of the list as a new variable for later use. *)
sublist1

You can also use the double brackets to select specific parts of a two-dimensional list

list2
list2[[3]]  (* Takes only the third element from list2 - in this case, the third element is itself a list. *)
list2[[3,1]] (* Takes the third element of list2, and then the first element of that. *)
list2[[3,2]] (* Takes the third element of list2, and then the second element of that. *)
list2[[3;;5]] (* Takes elements three through five of list2. *)
list2[[All,2]]  (* Takes all elements from list2 and then only the second element from each of them. *)

How to use “Do” loops for repetitive operations

Sometimes you want to do something many times - in this case, we use what is often called a “Do” loop.  In a Do loop you specify the operation to perform, as well as a starting and stopping value for the loop to step through.

Do[2+3,{i,1,5}]  (* Note the syntax: this loop will perform the operation 2+3.  It will do the operation once when i=1, once more when i=2, etc. until i=5. *)
Do[Print[2+3],{i,1,5}] (* If you type "Print[ ]" around the operation, it will show the results each time. *)

We usually use the stepping variable to do something more interesting in the Do loop.

Do[Print[2+i],{i,1,5}]

Do[Print[2+i],{i,0,1,.2}] (* You can specify a step size for the stepping variable - it assumes a step of 1 if you don't specify this. *)

Do loops get especially interesting when we use the stepping variable to refer to some part of our data list.

Do[Print[list2[[i]]],{i,1,3}]  (* Be careful with all those brackets! *)

Do[
Print[
list2[[i]]
]
,{i,1,3}]  (* The brackets don't all need to be on one line, and I often find it helpful to rewrite like this. *)

Do[
Print[
list2[[i]]
]
,{i,0,1,.2}]  (* Be aware that if you use a Do loop to refer to an element of a list, it must be an integer! (There is not a 0.2th element of list2). *)

Sometimes you might want to perform an operation on one part of a list, and then save it to a new list, there are a few ways to do this.  
Let’s say you wanted to add 10 to the second value of each pair in the list below, and then save it as the variable “newlist2”.

(* First we'll do an example that might seem logical but doesn't work because we haven't yet created the newlist2 variable.  *)
list2
Do[
newlist2[[i,1]]=list2[[i,1]]; (* Seems like it should just save the value to the newlist in the correct position. *)
newlist2[[i,2]]=list2[[i,2]]+10; (* Seems like it should add 10 and save the value to the newlist in the correct position. *)
,{i,1,5}]

(* The quickest way to create the newlist2 variable with correct dimensions is to simply make a copy of the old list. *)
list2
newlist2=list2;
Do[
newlist2[[i,1]]=list2[[i,1]]; (* Make the first part of the ith element the same. *)
newlist2[[i,2]]=list2[[i,2]]+10; (* Modify the second part of the ith element. *)
,{i,1,5}]
newlist2  (* now it works! *)