Many people get very confused when they first start dealing with tensors, partly because they've been told that they are "like" scalars, vectors and matrices, and because they think they know what these things - in some sense - are. The notion of a difference between covariant and contravariant vectors (for example) will thus completely confuse them.

While reading this writeup, please bear in mind that tensors are defined by what they do, not what they are.


Having said that, I can now define what a tensor is.

Structure

The structure of a tensor can be described by two things: its rank and its type.

Rank

If you think of a tensor as an grid-like array of elements, then the rank describes the number of dimensions the array possesses. For example, this could represent a rank 2 tensor:

      a11  a12  a13 ... 
      a21  a22  a23 ... 
Aij = a31  a32  a33 ... 
      .    .    .   . 
      .    .    .    . 
      .    .    .     .

because it's a 2-dimensional array; the elements are arranged in two directions. Geddit? A rank 3 tensor could have its elements arranged in a cube, and so on. Note that tensors are usually defined over a space with n dimensions; this number n gives the size of the array in every direction (I've just used dots to show the array extending arbitrarily above). A rank 2 tensor in a 3-dimensional space would be a 3-by-3 grid, for example.

That wasn't too painful now, was it?

Type

This is a bit more tricky. You saw in the example that we could locate any given element by means of its indices; i and j above. For obvious reasons (and practically by definition) a rank n tensor will have n indices. However, it turns out that these indices can behave in two different ways. We call those of one type contravariant indices (I'll define what that means later), and those of the other type covariant indices. The contravariant ones are written as superscripts, the covariant as subscripts; for this reason, they're often referred to as "upper" and "lower" indices, respectively. Thus, a tensor with one contravariant (upper) and two covariant (lower) indices would be written as Aijk.

What does this have to do with type? Well, the type of a tensor is an ordered pair of numbers which state how many of each index it has. For example, Aijk has type (1,2), and a general tensor with r contravariant indices and s covariant ones has type (r,s).

Of course, type makes rank redundant since a tensor of type (r,s) will necessarily have rank r+s.


Behaviour

This is the real meat of tensor theory. It's also quite difficult to write, involving as it does a lot of mathematical notation, including any number of partial differentials. I'll represent these using an operator notation, to make life easier for both of us. The partial differential of f with respect to x, normally written something like:

  ∂f
  --
  ∂x
will be written as
  x f
I'll also employ the standard operator notation for full differentiation if it comes up:
  Dx f

Scalars

Okay, these are fairly easy to understand. A scalar is a rank 0 tensor, which means it extends in no directions; it has only one element, no matter what. The elements of tensors can be thought of as functions; for any position in the n-dimensional space, the elements will have particular values. Read the function node if you aren't sure what that means; no point me reproducing it all here.

Anyway. You might then suppose (as most people do) that any single function is thus a scalar. This is not completely true (scalars are always relative tensors, but not necessarily absolute ones; never worry what that means for now). Basically, a function constitutes a scalar if its value at any position does not depend on the co-ordinate system used to locate that position. The polar co-ordinate system, in particular, has a tendency to produce "false infinities" at the origin. For all practical purposes, you can probably think of a scalar as a function.

Vectors

This is where things get tricky. Forget what you know about vectors, it'll only cause you confusion. There are two types of vectors; covariant vectors Ai, and contravariant ones Ai; both consist of a linear (one-dimensional) array. A linear array of functions (the elements of the tensor) is a vector if and only if it obeys one of these tensor transformation laws when converting the vector Ai (or Ai, depending on which transformation law we are checking) from one set of co-ordinates xi to a different set yi (where we call the vector Bi to distinguish it):

Covariant vectors

Bi =  Σnj=0  yi xj ⋅ Aj

Contravariant vectors

Bi =  Σnj=0  xj yi ⋅ Aj

Remembering that we defined x so that

        ∂y
x yi = --
        ∂x

If it does not obey either law, it is not a vector. This is the part that confuses people; basically, we've defined vector to mean something that transforms in this way. Those summation signs really get in the way, so we usually just dispense with them and say something like:

Bi = xj yi ⋅ Aj

This is called the Einstein summation convention, because you-know-who came up with it. Any index that appears twice in a single term (like j above) is summed over.

So that's vectors for you.

Rank 2 tensors

Contrary to popular belief, these are not all matrices; only the type (1,1) tensors are. Rank 2 tensors can be split into three categories, according to which of these transformation laws they obey:

Type (0,2) ("Covariant tensor")

Bij = yi xayj xb ⋅ Aab

Type (2,0) ("Contravariant tensor")

Bij = xa yixb yj ⋅ Aab

Type (1,1) ("Mixed tensor")

Bij = xa yiyj xb ⋅ Aab

I won't go into the details of why only the (1,1) tensors are like matrices here, preferring to save that for the tensor algebra node.

General tensors

I expect you've noticed the pattern in the above transformation laws; the pairs of "dummy" indices used in the summations cancel out in pairs (eg, one covariant b cancels with one contravariant b), and whatever indices are left must match with those on the other side of the equals sign (including their type). We can put together a general transformation law for any tensor of type (r,s) as follows. I haven't written them all, but there are r contravariant (upper) indices and s covariant (lower) ones. We are transforming a tensor Tij...kl... in the co-ordinate system xi into Sij...kl... in yi:

Sij...kl... = (xa yixb yj ⋅ ...) (yk xcyl xd  ⋅ ...) Tab...cd...

And that's it. Anything which transforms in that way is a tensor of type (r,s)