# Quick question about determinants in mathematica

1. Apr 19, 2012

### Amok

Sup guys,

So, I'm totally new to mathematica. I need to use it in order to compute a determinant of a
4x4 matrix that is made up entirely of functions. I almost managed to do this in wolfram alpha, but for a 4x4 matrix, the input is too long. Do you guys know how to do this (and if it even possible)?

2. Apr 19, 2012

### Bill Simpson

Is this example enough to show you how to do this?

In[1]:= Det[{{Sin[t],Log[t]},{t^2,1+t}}]

Out[1]= -t^2 Log[t] + Sin[t] + t Sin[t]

3. Apr 19, 2012

### gsal

Are you totally new to mathematics, too? Working out a determinant for a 4x4 matrix by hand is not much of a problem.

4. Apr 20, 2012

### Hepth

I assume the functions are rather lengthy, and Mathematica is great for simplifying. I think you are assuming its a 4x4 of constants.

The above example should be enough.
Det[] is the function.
Tables/Matrices are entered as:

nameofmatrix = {{1,2,3,4},{5,6,7,8},{9,1,2,3},{4,5,6,7}}

for a 4x4 of constants. You can put the functions in by yourself, or define them prior:

F[1,1] = x^2;
F[1,2] = 3 x + 4;
F[1,3] = Sin[x];
F[1,4] = x^2;
F[2,1] = 3 x + 4;
F[2,2] = Sin[x];
F[2,3] = x^2;
F[2,4] = 3 x + 4;
and so forth for all 16 functions;

Then if you have all 16 functions defined as F[i,j] do:

matrix = Table[F[i,j],{i,1,4},{j,1,4}];
det = Det[matrix]

And you can simplify with :

detS = Simplify[det]

oor detFS = FullSimplify[det]

And if you don't know, since you're new, to execute the command you use "SHIFT ENTER" to run the statement.

5. Apr 20, 2012

### Amok

Honestly, that was uncalled for. If you want to know, I want to compute more than one determinant (I have a linear combination of them) and then collect terms and look for pattern in these functions. Moreover there are four different variables involved. I've been trying by hand, but it's obviously a lengthy procedure and keeping track of all the variables and indexes without making a single mistake is hard...

Thank you for you reply. I tried something like that, but I don't have the explicit form of the functions, I have to write something like f1(x1)*a(y1), f2(x2)*a(y2), f3(x3)*a(y3)... (and permutations). I see that you wrote Sin[X] and not sin(x), so that might help. Gonna try it ASAP

:P

EDIT: Waddya know, it worked! Thx a bunch.
EDIT2: Holy crap! This program is awesome, it actually simplifies stuff :)
EDIT3: Hey, it worked while I called my matrix 'mat' and my determinant 'det', but then I changed them to matrix, or mat1 or det1 and the name became blue and the operations didn't work anymore. I'm having a hard time defining two matrices to use in my computations. Do I have to open a new cell to define each one of them? Or variables for that matter? Why do some names become blue, while others are black? I've read an intro to mathematica, but I'm still confused about this.

Last edited: Apr 20, 2012
6. Apr 20, 2012

### lpetrich

blue = undefined variable, black = defined variable

You need to set a blue variable to something to make it black. You can do it in the same cell as the previous work, separating with a ; or you can create a new cell. I suggest practicing on simple operations if you are unfamiliar with Mma. Like

Expand[(1+x)^4]
Factor[x^2+x-2]

7. Apr 20, 2012

### Amok

I found out that I need to use subscripts in order to label variables and especially functions, because mathematica was getting confused about wether the numbers were labels or actual numbers (hence variables that remained undefined). Everything's working fine now. Thanks.