Vector: A series of scalars contained in a column or row. Dimensions: How many rows and columns a vector or matrix has.

Similar documents
Linear Algebra Review

x = 12 x = 12 1x = 16

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions:

Physics 326G Winter Class 2. In this class you will learn how to define and work with arrays or vectors.

MATLAB for Experimental Research. Fall 2018 Vectors, Matrices, Matrix Operations

Lecture 5: Matrices. Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur

Matrix algebra. Basics

Chapter 1: Number and Operations

AH Matrices.notebook November 28, 2016

Lecture 2: Variables, Vectors and Matrices in MATLAB

0_PreCNotes17 18.notebook May 16, Chapter 12

Put the following equations to slope-intercept form then use 2 points to graph

Therefore, after becoming familiar with the Matrix Method, you will be able to solve a system of two linear equations in four different ways.

Finite Math - J-term Homework. Section Inverse of a Square Matrix

Machine Learning for Signal Processing Fundamentals of Linear Algebra

FreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx

Maths for Signals and Systems Linear Algebra in Engineering. Some problems by Gilbert Strang

Chapter 2 and Supplements MATRICES

1 Overview of the standard Matlab syntax

MATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA

MATLAB Tutorial Matrices & Vectors MATRICES AND VECTORS

LSN 4 Boolean Algebra & Logic Simplification. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

Introduction to MATLAB

Introduction to Matrix Operations in Matlab

Mathematical Operations with Arrays and Matrices

Rapid growth of massive datasets

PetShop (BYU Students, SIGGRAPH 2006)

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013

MATLAB: The Basics. Dmitry Adamskiy 9 November 2011

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab

Vectors and Matrices. Chapter 2. Linguaggio Programmazione Matlab-Simulink (2017/2018)

Arrays, Matrices and Determinants

Matrix Multiplication

MAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB

TUTORIAL 1 Introduction to Matrix Calculation using MATLAB TUTORIAL 1 INTRODUCTION TO MATRIX CALCULATION USING MATLAB

Constraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial

One-dimensional Array

Identity Matrix: >> eye(3) ans = Matrix of Ones: >> ones(2,3) ans =

Exercise Set Decide whether each matrix below is an elementary matrix. (a) (b) (c) (d) Answer:

MATH 2221A Mathematics Laboratory II

Introduction to MATLAB for Engineers, Third Edition

Matrix Multiplication

Lab 0a: Introduction to MATLAB

Machine Learning for Signal Processing Fundamentals of Linear Algebra

Introduction to Matlab. By: Hossein Hamooni Fall 2014

Chapter 18 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal.

Armstrong State University Engineering Studies MATLAB Marina 2D Arrays and Matrices Primer

18.02 Multivariable Calculus Fall 2007

Computer Packet 1 Row Operations + Freemat

Teachers Teaching with Technology (Scotland) Teachers Teaching with Technology. Scotland T 3. Matrices. Teachers Teaching with Technology (Scotland)

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB

MATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks

MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB

Introduction and MATLAB Basics

MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED. Christian Daude 1

HW0 v3. October 2, CSE 252A Computer Vision I Fall Assignment 0

Array Accessing and Strings ENGR 1181 MATLAB 3

CPSC 340 Assignment 0 (due Friday September 15 ATE)

Course Number 432/433 Title Algebra II (A & B) H Grade # of Days 120

Mathematics. 2.1 Introduction: Graphs as Matrices Adjacency Matrix: Undirected Graphs, Directed Graphs, Weighted Graphs CHAPTER 2

Parallel development II 11/5/18

ENGR 1181 MATLAB 02: Array Creation

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

Matlab- Command Window Operations, Scalars and Arrays

Experiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?

Mathematics 4330/5344 #1 Matlab and Numerical Approximation

Algebra 1. Standard 11 Operations of Expressions. Categories Combining Expressions Multiply Expressions Multiple Operations Function Knowledge

Addition/Subtraction flops. ... k k + 1, n (n k)(n k) (n k)(n + 1 k) n 1 n, n (1)(1) (1)(2)

Dr Richard Greenaway

Introduction to Matlab

Factoring. Factor: Change an addition expression into a multiplication expression.

LAB 2 VECTORS AND MATRICES

Matrix Multiplication

Chapter 2. MATLAB Fundamentals

CME 192: Introduction to Matlab

Introduction to MATLAB

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop

1 Introduction to Matlab

Daily Warm-Ups ALGEBRA

4. Linear Algebra. In maple, it is first necessary to call in the linear algebra package. This is done by the following maple command

A Quick Introduction to MATLAB/Octave. Kenny Marino, Nupur Chatterji

MAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB

Introduction. Matlab for Psychologists. Overview. Coding v. button clicking. Hello, nice to meet you. Variables

MATLAB NOTES. Matlab designed for numerical computing. Strongly oriented towards use of arrays, one and two dimensional.

Systems of Inequalities and Linear Programming 5.7 Properties of Matrices 5.8 Matrix Inverses

Math 1526: Excel Lab 5 Summer 2004

AN INTRODUCTION TO MATLAB

Introduction to MATLAB

ARRAYS COMPUTER PROGRAMMING. By Zerihun Alemayehu

Getting started with MATLAB

MAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB

An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type.

Control Structures. March 1, Dr. Mihail. (Dr. Mihail) Control March 1, / 28

Matrix Inverse 2 ( 2) 1 = 2 1 2

AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA

Matrices 4: use of MATLAB

If a b or a c, then a bc If a b and b c, then a c Every positive integer n > 1 can be written uniquely as n = p 1 k1 p 2 k2 p 3 k3 p 4 k4 p s

Introduction to MatLab. Introduction to MatLab K. Craig 1

GraphBLAS Mathematics - Provisional Release 1.0 -

Transcription:

ASSIGNMENT 0 Introduction to Linear Algebra (Basics of vectors and matrices) Due 3:30 PM, Tuesday, October 10 th. Assignments should be submitted via e-mail to: matlabfun.ucsd@gmail.com You can also submit HW0 in person in class. Survey Please go to this link: https://www.surveymonkey.com/r/j25wwcc Completing this survey is required to get full credit for HW0. Homework The goal of HW0 is to review matrices and basic linear algebra. We will play with matrices in MATLAB, but it s important to understand them conceptually before using them in programs. You don t need to worry about terminology per-se or how to implement them in Matlab. That will be covered in class. Definitions for the purposes of this class: Scalar: A single value, (e.g.: -1, 2.35, 10/3) Vector: A series of scalars contained in a column or row e.g. V1 = [ 1, 2, 4.5, 3] row vector 1 V2 = [ 2] column vector 3 Dimensions: How many rows and columns a vector or matrix has. V1 has 1 row and 4 columns or 1x4 V2 has 3 rows and 1 column or 3x1. Note that a vector has either one 1 row or 1 column. Matrix: A series of vectors that form a rectangular shape. Note: Each row or column will have the same amount of values. M1 = [ 1 3 5 ] 2x3 matrix 2 4 6 1 2 M2 = [ 3 4] 3x2 matrix, and transpose of M1 5 6

1 2 3 M3 = [ 4 5 6] 3x3 matrix 7 8 9 Indexing vertices and matrices: You can refer to any part of a matrix or vector with the proper index. Format is ALWAYS (# of row, # of column). And the first row or column is ALWAYS 1 in MATLAB. Students with a programming background may be used to 0 as the first. MATLAB does not work that way. Any one value in a matrix or vector is referred to as an element. M1(2,3) = 6. M2(3,1) = 5 M3(2,1) = 4 V1(1,3) = 4.5 V2(1,2) = DNE (Does not exist because V2 only has one column) Special matrices Identity: A square matrix that when multiplied with another matrix results in the original matrix. Only values are 0 s and 1 s, with 1 s going down diagonally top left to bottom right. 1 0 0 [ 0 1 0] 0 0 1 Transpose: A matrix that has its values flipped across the diagonal. Given an index location (a,b), the value is then swapped with (b,a). Basic operations M3 = [ 2 1 3 4 7 8 ] 2 4 M3 T = M3 = [ 1 7] 3 8 Addition (+) and Subtraction (-) Scalar +/- vector or matrix: Add/Subract the scalar value to each element in a vector or matrix. 3 V1 = 3 [ 1, 2, 4.5, 3] = [2,1, 1.5,6] Vectors and matrices: Add the corresponding elements in the two vectors or two matrices together.

M1 + M3 = [ 1 3 5 2 4 6 ] + [2 1 3 4 7 8 ] = [3 4 8 6 11 14 ] Dimensionality: Matrices and vectors have to have the same dimensions. You cannot add a row vector with a column vector, or a 2x3 matrix with a 3x2 matrix. 1 [ 2] + [1 2 3] = DNE 3 Product Multiplication (*) WARNING: Dimensions of vectors and matrices have to match up properly. When multiplying two vectors and matrices, the number of columns of the first must match the number of rows of the second item. The result has the dimensions of the first item s rows and the second item s columns. (2x3 matrix)*(3x4 matrix) = (2x4 matrix) (1x3 vector)*(3x3 matrix) = (1x3 vector) (1x3 row vector)*(3x1 col vector) = (scalar value or 1x1) Vector Product Multiplication (http://stattrek.com/matrix-algebra/vector-multiplication.aspx): Result is either a scalar (inner product) or matrix (outer product). Go to the link to read up more on vector multiplication. [a b] [ c ] = a c + b d d Note: (1x2 * 2x1 vectors leads to one value. The left side s row is multiplied with each corresponding element in the right sides column. [ a b ] [ a c a d a e c d e] = [ b c b d b e ] Note: (2x1*1x3 vector becomes a 2x3 matrix. The first row on the left only has one element and it is multiplied with one element from each column on the right. Matrix Multiplication (http://stattrek.com/matrix-algebra/matrix-multiplication.aspx): Two matrices always result in another matrix. The dimensionality needs to be confirmed first (inner dimensions must be equal as always). The same method is used as in vector multiplication. a b f g e + b h a f + b i a g + b j [ ] [e ] = [a c d h i j c e + d h c f + d i c g + d j ]

Note: 2x2 * 2x3 = 2x3 matrix. Element (1,1) in the resulting product is the first row elements multiplied and summed with the first column of the second matrix. Element (2,3) is the second row of the first matrix ([c,d]) times the third column of the second matrix ([g;j], etc. Element-wise multiplication (.*) Multiply the same element in each matrix or vector with a given value. Matrices and vectors have to be the same dimension! a b c h i g b h c i [ ]. [g ] = [a d e f j k l d j e k f l ] Note: In MATLAB, element-wise multiplication is denoted with a period followed by multiplication. You can also do division like this as well. Addition and subtraction are already element-wise operations. This covers the majority of the linear algebra concepts you will need for this class. The links above go into more detail, and any other questions can be addressed to the TA or professor. Questions Addressing array elements 1) What is V(5) in row vector V = [ 1 0 2 4 6]? 1 2 2) What is M(2,3) in the matrix M = [ 9 8]? 0 5 3) What is M(3,2)? Matrix operations Underline/Box/Circle true or false for the following questions. 4) True or False? When adding two matrices, the dimensions of the two matrices must be equal. 5) True or False? When multiplying two matrices, the dimensions of the two matrices must be equal.

6) True or False? The product matrix A and matrix B always has dimensions equal to either A or B. 7) True or False? You can only multiply a scalar and a square matrix. Matrices: A,B,C, and D and Scalars: s and t are used in the following exercises. 1 1 9 3 2 1 0 1 1 1 0 0 2 8 A = [ 5 5 6 33] B = [ ] C = [ ] D = [ 3 3 0 3] s = 2 t = 0.5 1 3 7 9 8 7 0.2 0 2 2 2 0 4 6 Compute the answers to the following expressions or indicate that there is no answer (DNE). + means addition, * means multiplication, * means element-by-element multiplication, means transpose of the matrix or vector. 8) A+s 9) B-s 10) D*t 11) A+D 12) A+B 13) A*C

14) A.*D 15) D*B 16) D*A 17) B.*B 1 2.3 4 1 0 0 18) [ 5 6 1.2 ] [ 0 1 0] = 3.5 5.6 9.4 0 0 1