18 views

Uploaded by Syed Raheel Adeel

Linear Algebra

- Newton's Second Law
- Quadrics - Linear algebra, analytic geometry, differential geometry
- Customer Services Advisor Cv
- Visual Dictionary
- Future in the Past
- Light of the World
- The Sound of One Hand Clapping is a Novel by Richard Flanagan About the Migrant Experience
- Basics Norwegian Words
- M542 Stepper Motor Drive
- Notes on Linear Algebra.pdf
- Prospects Workbook unit 1
- Newton's Second Law - Revisited
- The Boy in the Striped Pyjamas Extract
- Technology Based Strategies for Promoting Clinical.11
- Edexcel Unseen Poetry GCSE English Literature
- B2 Cosmic
- Snapshot Starter Language Booster Workbook CLASA V.pdf
- Short Grammar of Norwegian-NTNU
- Computer Mediated Communication for Promoting Inter-Cultural Competencies
- How to Write a Good Argumentative Essay

You are on page 1of 33

Matrices

Methods for Dummies

21st October, 2009

Elvina Chu & Flavia Mancini

Talk Outline

Scalars, vectors and matrices

Vector and matrix calculations

Identity, inverse matrices &

determinants

Solving simultaneous equations

Relevance to SPM

Scalar

Variable described by a single

number

e.g. Intensity of each voxel in an MRI scan

Vector

Not a physics vector (magnitude, direction)

Column of numbers e.g. intensity of same

voxel at different time points

x1

x 2

x3

Matrices

Rectangular display of vectors in rows and

columns

Can inform about the same vector intensity at

different times or different voxels at the same

time

Vector

d11 d12 d13

4

1 2 is3just a n x 11 matrix

A 5 4 1

6 7 4

C 2 7

3 8

Square (3 x 3) Rectangular (3 x 2)

Defined as rows x columns (R x C)

Linear Algebra & Matrices, MfD 2009

D d 21

d 31

d

ij

d 22

d 32

d 23

d 33

Matrices in Matlab

X=matrix

;=end of a row

:=all row or column

1 2 3

4 5 6

7 8 9

matrix can be addressed with a pair

of numbers; row first, column second

Special matrix

commands:

(Roman Catholic)

zeros(3,1) =

e.g.

X(2,3) = 6

7 8 9

X(3, :) =

5

X( [2 3], 2) =

8

ones(2) =

8 1 6

3 5 7

magic(3) = 4 9 2

er

ve ror

ct

or

e : et

1 as

to

9)

da

ve ta

ct

or

d

m esig

at n

ri

x

pa

ra

=

m

et

(h the

er

er b

s

Design matrix

Transposition

1

b 1

2

column

bT 1 1 2

row

1 2 3

A 5 4 1

6 7 4

d 3 4 9

row

1 5 6

A T 2 4 7

3 1 4

T

d 4

9

column

Matrix Calculations

Addition

Commutative: A+B=B+A

Associative: (A+B)+C=A+(B+C)

2

AB

2

1 0

2 1

5 3 1

23

4

4 0 3

5 1 5

Subtraction

- By adding a negative

matrix

2 4 2

A BA B

5 3 2

12 2 1 12 4 2 2 1 12 1 1 12 1

32 4 1 15 3 2 2 3 14 1 2 1 1 1

Scalar multiplication

Scalar x matrix = scalar

multiplication

Matrix Multiplication

When A is a mxn matrix & B is a kxl

matrix, AB is only possible if n=k. The

result will be an mxl matrix

A1 A2 A3

B13 B14

A4 A5 A6

A7 A8 A9

A10 A11

A12

B15 B16

= m x l matrix

B17 B18

Matrix multiplication

Multiplication method:

Sum over product of respective rows and columns

1 0

2

X

2 3

3

A

B

=

Matlab

does all this for you!

Simply type: C = A * B

c11 c12

c21 c22

Define

output

matrix

(1 2) (0 3) (11) (0 1)

(2 2) (3 3) (2 1) (3 1)

2 1

13 5

Matrix multiplication

Matrix multiplication is NOT

commutative

ABBA

Matrix multiplication IS associative

A(BC)=(AB)C

Matrix multiplication IS distributive

A(B+C)=AB+AC

(A+B)C=AC+BC

Linear Algebra & Matrices, MfD 2009

Vector Products

Two vectors:

x1

x x2

x3

y1

y y2

y3

Inner product XTY is a scalar

(1xn) (nx1)

xT y x1

x2

y1

3

y x y x y x y

xi yi

1 1

2 2

3 3

2

i 1

y3

x3

x1

xy T x 2 y1

x 3

y2

x1y1

y 3 x 2 y1

x 3 y1

x1y 2

x2y2

x3y2

x1y 3

x 2 y 3

x 3 y 3

(nx1) (1xn)

Identity matrix

Is there a matrix which plays a similar role as the number 1 in

number multiplication?

Consider the nxn matrix:

For any nxm matrix A, we have In A = A, and A Im = A (so 2 possible

matrices)

Linear Algebra & Matrices, MfD 2009

Identity matrix

Worked

example

A I3 = A

for a 3x3

matrix:

1+0+0

0+2+0

0+0+3

4+0+0

0+5+0

0+0+6

7+0+0

0+8+0

0+0+9

Matrix inverse

Definition. A matrix A is called nonsingular or

invertible if there exists a matrix B such that:

1

-1

2

3

1

3

-1

3

1

3

2+1

3 3

-1 + 1

3 3

-2+

-2+ 2

3

3

1+2

3 3

the inverse of a matrix A is A-1. So:

The inverse matrix is unique when it exists. So if A is

invertible, then A-1 is also invertible and then (AT)-1 = (A-1)T

In Matlab: A-1 = inv(A)

A*B-1

Matrix inverse

For a XxX square matrix:

Determinants

Determinants are mathematical objects that are very useful in

the analysis and solution of systems of linear equations (i.e.

GLMs).

The determinant is a function that associates a scalar det(A)

to every square matrix A.

Input is nxn matrix

Output is a single

number (real or

complex) called the

determinant

det(M)

M11

M12

M 21

M

M n1

M 22 L

M O

Mn2 L

M1n

M 2n

sgn(x)M1x1 M 2x 2 L M nxn

M

x

M nn

Determinants

Determinants can only be found for square matrices.

For a 2x2 matrix A, det(A) = ad-bc. Lets have at closer look at

that:

[ ]

det(A) = a

c

b

d

= ad - bc

Linear Algebra & Matrices, MfD 2009

Solving simultaneous

equations

For one linear equation ax=b where the unknown is x

and a and b are constants,

3 possibilities:

Can use solutionx a 1b

equation to solve

For example 2 x 3 x 5

1

x1 2 x2 1

3

1 2

x1 15

x 41

2

X =

In matrix form 2

X =A-1B

Linear Algebra & Matrices, MfD 2009

X =A-1B

To find A-1

1 d b

A

det(A) c a

1

a b

det( A)

ad bc

c d

From earlier

2 3

1 2

(2 -2) (3 1) = -4 3 = -7

So determinant is -7

Linear Algebra & Matrices, MfD 2009

1 2 3 1 2 3

A

(7) 1 2 7 1 2

1

if B is

1

4

1 2 3

X

7 1 2

x a 1b

1 1 14

2

4 7 7 1

x1 2

So

x 2 1

Linear Algebra & Matrices, MfD 2009

to fMRI data?

Image time-series

Design matrix

Spatial filter

Realignment

Smoothing

Statistical Parametric Ma

Normalisation

Anatomical

reference Parameter estimates

Linear Algebra & Matrices, MfD 2009

Statistical

Inference

RFT

p <0.05

Time

Model

Model

specificati

specificati

on

on

Parameter

Parameter

estimation

estimation

Hypothesis

Hypothesis

Statistic

Statistic

m

Ti

e

BOLD signal

single

singlevoxel

voxel

time

timeseries

series

Linear Algebra & Matrices, MfD 2009

SPM

SPM

er

ve ror

ct

or

da

ve ta

ct

or

d

m esig

at n

ri

x

pa

ra

m

et

er

s

data?

GLM equation

da

ve ta

ct

or

data?

Response variable

successive time points.

Each voxel is considered as

independent observation.

Y

Linear Algebra & Matrices, MfD 2009

Ti

Time

me

particular voxel

Preprocessing .

..

Intens

ity

Y= X. +

de

m sig

at n

ri

x

pa

ra

m

et

er

s

data?

Explanatory

variables

These are assumed to

be measured without

error.

May be continuous;

May be dummy,

indicating levels of an

experimental factor.

how much of the BOLD signal

is explained by X

Y= X. +

In Practice

Estimate MAGNITUDE of signal

changes

MR INTENSITY levels for each voxel

at various time points

Relationship between experiment

and voxel changes are established

Calculation and notation require

linear algebra

Summary

SPM builds up data as a matrix.

Manipulation of matrices enables

unknown values to be calculated.

Y

=

X

.

Error

BOLD

= Design Matrix * Betas + Error

References

SPM course http://www.fil.ion.ucl.ac.uk/spm/course/

Web Guides

http://mathworld.wolfram.com/LinearAlgebra.html

http://www.maths.surrey.ac.uk/explore/emmaspages/op

tion1.html

http://www.inf.ed.ac.uk/teaching/courses/fmcs1/

(Formal Modelling in Cognitive Science course)

http://www.wikipedia.org

Previous MfD slides

- Newton's Second LawUploaded byyolo230395
- Quadrics - Linear algebra, analytic geometry, differential geometryUploaded bycecilchiftica
- Customer Services Advisor CvUploaded byRestoration2010
- Visual DictionaryUploaded bycaro sturges
- Future in the PastUploaded byChristian Bravo Vallejo
- Light of the WorldUploaded byEli Dawson
- The Sound of One Hand Clapping is a Novel by Richard Flanagan About the Migrant ExperienceUploaded bygkushagra_sat
- Basics Norwegian WordsUploaded byMYGM10
- M542 Stepper Motor DriveUploaded byElvio Junges
- Notes on Linear Algebra.pdfUploaded byMohammad Umar Rehman
- Prospects Workbook unit 1Uploaded bySilva Sharphy
- Newton's Second Law - RevisitedUploaded byRob Dickson
- The Boy in the Striped Pyjamas ExtractUploaded bygroupthing
- Technology Based Strategies for Promoting Clinical.11Uploaded byDominique Excelsis J. Degamo
- Edexcel Unseen Poetry GCSE English LiteratureUploaded byAndrew Kendall
- B2 CosmicUploaded bykc
- Snapshot Starter Language Booster Workbook CLASA V.pdfUploaded bydmarbada
- Short Grammar of Norwegian-NTNUUploaded byJahid Masud Akon
- Computer Mediated Communication for Promoting Inter-Cultural CompetenciesUploaded byAlexSRWalsh
- How to Write a Good Argumentative EssayUploaded byRalucaIoanaOprea
- Gcse Maths a Linear 2540Uploaded bysiddharthmenon
- Click on 3 WBUploaded byMartin Nedev
- Customer Advisor JDUploaded byHarvey Stanhope
- GCSE Maths algebra - formulae - changing subjectUploaded bygcsemathstutor
- CambridgeUploaded bycrymsoncrymson
- GCSE English LiteratureUploaded byAheedam Mohammed
- Summative Test Math Grade 8Uploaded byRox Francisco

- What is International Standard OrganizationUploaded bySyed Raheel Adeel
- Chain DrivesUploaded bySyed Raheel Adeel
- Chain DrivesUploaded bySyed Raheel Adeel
- Chain Drive PresentationUploaded bySyed Raheel Adeel
- REPORT on TEMPERTURE CONTROLLERUploaded bySyed Raheel Adeel
- Stopping DistancesUploaded bySyed Raheel Adeel
- Refrigeration CyclesUploaded bySyed Raheel Adeel
- Gsmst Foe 18 Section_drawings 07Uploaded bySyed Raheel Adeel
- general physicsUploaded bySyed Raheel Adeel
- PerformancExcellence Six SigmaUploaded byJuan Pablo Bustamante
- 4 ProbabilityUploaded byNeha Mavi Basoya
- Chap # 1 Funtion & LimitsUploaded byƛsadƛlȝ
- ! Introduction to PlcUploaded bySyed Raheel Adeel
- ! Introduction to PlcUploaded bySyed Raheel Adeel
- Fluid MechanicsUploaded byMuhammad Zulhilmi
- PMpr2aUploaded bySyed Raheel Adeel
- probability.pptUploaded byArvind Sharma
- Sheet Metal FormingUploaded bySyed Raheel Adeel
- Conic SectionsUploaded bysubham
- Quaid's Speech -State Bank InaugurationUploaded bySyed Raheel Adeel
- Ages of ComputerUploaded bySyed Raheel Adeel
- Check SheetsUploaded bySyed Raheel Adeel
- Refrigeration CyclesUploaded bySyed Raheel Adeel
- Patterns of DataUploaded bySyed Raheel Adeel
- Semiconductor FabricationUploaded bySyed Raheel Adeel
- PMpr2bUploaded bySyed Raheel Adeel
- Unit 4 - Imaginary NumbersUploaded bySyed Raheel Adeel
- PMpr1Uploaded bySyed Raheel Adeel
- 5.4 Complex NumbersUploaded bySyed Raheel Adeel

- Network Monitoring ToolsUploaded byAga A
- Pansat 3500s Setup GuideUploaded byetz3l
- dental decks 2009-2010 (1)Uploaded byJoe McGoo
- Esquire - November 2013 UKUploaded byklavdian
- MAHU Statement - Mandates FinalUploaded byTim
- Event ChecklistUploaded byWendy Waldorf
- INTERVENTION FOR IA CBT.pptxUploaded byIna Hasim
- Bavanisree - Resume.pdfUploaded byvenugopal chinayah
- Methanol Production From Cow DungUploaded byAlexander Decker
- Edward McKnight KaufferUploaded byDejan Bogdanovic
- 40pfs6609_12_pss_Uploaded byMujo Velić
- THE_STUDY_OF_SERVICE_CORE_IN_A_TALL_HOTE.pdfUploaded bySahil Pruthi
- Biology UNIT 1 Revision GuideUploaded byChristopher Do
- Eng102 Final Research PaperUploaded byJasmine Marie Ng Cheong
- Adilabad District Action PlanUploaded byBUKA RAMAKANTH
- Conditional SentencesUploaded byTiada Hari Tanpa Hary
- Mattwarnockguitar.com-Phrygian Dominant Scale Guitar Patterns Chords and HarmonyUploaded byToroPolaco
- BJ30 Transistor Data sheetUploaded byAili Luggymix
- powerpoint photo essay rubricUploaded byapi-233194349
- Effect of Different Nitrogen Fertilization Levels on Yield of Maize Zea Mays L as Winter ForageUploaded byIJSTR Research Publication
- PPD cvUploaded byBethyates2013
- multiple intelligencesUploaded byapi-278669813
- Small Donor Tax Credits: A New ModelUploaded byThe Brennan Center for Justice
- 14_appendix 1.pdfUploaded byAnonymous qAPTE8REmn
- Group14_RiskManagementPlanUploaded byAmit Bhowal
- Removal of Impacted Third MolarUploaded byHarkan
- RKS - AIRFIELD LIGHTING.docUploaded byChristofel Risky Wuwungan
- s 6070756Uploaded byPradeep Kumar
- Introduction to Psychology.docxUploaded byShaira Ires Braza
- beamanal.xlsUploaded byAiman Amir