hello and welcome to this first section of this course if you are familiar with
the matrices you can skip this section if you know what is a matrix and what
are the basic types of matrices and some basic commands in Scilab I will not be
showing many commands of Scilab in this in this first lecture I will be just
explaining some points some key points about matrices because Scilab is based
on matrices and if you do not have a solid foundation in matrices then you
will be struggling in this course for those who are very big nurse who are not
very much familiar or maybe they have taken a course in matrices for very long
time so this section will be a good and very quick review so let's get started
what is a matrix matrix is simply an arrangement of numbers so these numbers
could be coming from any background information you might have an excel
sheet or you might have data somewhere stored in any database but as far as
definition is concerned a matrix is simply a table of numbers or you can say
a 2d array of numbers so you can define a matrix however you like no matrix is
denoted by a square bracket here on both sides of numbers and these numbers are
card elements are entries of a matrix so this is the row of a matrix so this is a
first row this is second row and this is third row similarly these this is the
first column and there are three columns so their elements resides in a row and
in a column and this is the general description of a matrix so we describe
matrix generally in mathematics in this formation so this means that element a
resides in first row and first column the first digit in the subscript shows
them row in which this element results and the second digit shows the column
for example this element is in second row in second column so if a matrix has
equal number of rows and columns exemple this matrix has three rows and
three columns so if the rows and columns are equal then the matrix is called
square matrix and if this is not the case then the matrix is called a
rectangular matrix this definition is important sometimes because this square
matrix a are of much more interest for us but we also use these rectangular
matrix these are some of the key points about matrices the first thing is the
order of a matrix so order of matrix is simply described as the number of rows
multiplied by the number of columns so if a matrix has 2 rows and 3 columns the
order will be 2 multiplied by 3 if a matrix is square you can say the square
matrix of order 3 because square matrix have both number of rows and number of
the columns equal so you can describe it with one number so the second thing is
element which I already I have described matrix addition so when we say matrix
addition and multiplication there are some conditions for addition and
multiplications so for addition the condition is that if you want to add two
matrices the both of those matrix should have same order so if one matrix had has
an order of 2 multiplied by 3 the other matrix must be of the same order they
must not it's not a requirement that they should be square matrix but their
order should be same so because each and every element of first matrix will be
added to the corresponding element in the second Matrix now when it comes to
multiplication there are two important points the first important point is that
multiplication of a with B a B is not necessarily in most of the cases it's
not equal to be multiplied by a these two are totally different situations and
sometimes a B is possible but is even not possible so this is the
first point and why it is so due to this second point because the condition for
multiplication is that if you are multiplying two matrices a and B the
number of column of the first matrix which is occurring first you see the
number of columns of the first matrix must be equal to the number of rows of
the second Matrix if you are getting a product of B multiplied by a then you
will see the columns of C and rows of a you always see the columns of the first
metric for example this matrix this is a very interesting matrix as you can see
that this matrix has 4 columns 1 2 3 4 and this column has 4 rows so if I want
to multiply a B so how many columns a have 4 and how many rows behave 4 so I
can get this product and we will talk about this how to do the multiplication
in the next lecture but at this lecture it's only we are looking at the
conditions whether a B is possible or not now what about B a in B we have to
look how many columns behave we have only one column and how many rows am he
have only one row so B a is also possible so in this situation as you can
see that a B and B both are possible for this type of matrix and if a matrix has
only one row it is also called a row matrix it is also called a row matrix
are sometimes you can call it a row vector similarly if a matrix is only a
one column you can call it column matrix or column vector so this row vector and
this column vector can be multiplied in both Direction a b-and-b other than that
if the both of the matrix are square matrices of the same order for example 3
cross 3 or 4 cross 4 if both are 3 cross 3 the krusty then both
be multiplied in both direction the next thing is a very simple concept I wanted
to highlight here that if you want to multiply a matrix with a constant value
so the resultant would be that this constant will be multiplied with each
and every element of the matrix the next thing is transpose of a matrix so
transpose of a matrix for example a is a matrix this is a matrix a very simple
matrix 1 2 3 up to 9 so if you make a first row as a first column and the
second row as a second column and the third row as a third column then the
matrix which you will get is called the transpose of the matrix and this is
denoted by a transport or a dash or a prime whatever you call it
this is another example of transpose as you can see that in this case we have
our first matrix which has a have a has an order of two x for two rows and four
column if you take the transpose of this matrix so the first row will become
first column and the second row will become for second column now the order
will be 4 into 2 so the order will be changed so let us see how we can use our
knowledge of matrices at this stage in Scilab so at this stage we don't know
much about matrices but we know two things one is that we know how to make a
matrix and the second thing is how to what is the transpose of a matrix so we
will use these two things so how to make a matrix in Scilab
so in Scilab for example I want to make a matrix a which is which has 3 rows 1 2
3 is in the first row 4 5 6 7 7 8 7 8 9 in the third row so I will do like this
a equals square brackets then there are two ways the first ways you make first
element then space second element space third element and semicolon to end the
row then the first element of the second row space second element space
third element then and the row with a semicolon and then seven space eights PS
nine and close the square bracket and we will get the matrix a so this is your
one way to define a matrix the second way to define a matrix is that you use
comma instead of space so it can be defined let us say we define VB equals
let's say the same matrix so 1 comma 2 comma 3 semicolon 4 comma 5 comma 6
semicolon 7 comma 8 comma 9 and then close the square bracket so this is your
matrix B because both matrix have same order so we can add them so let us say C
is there a sum so C equals a plus B so it will add the corresponding elements
of both matrices the first element and the first row and first column will be
added in first row and first column so you will get 2 similarly 2 will be added
to 2 you will get 4 and you can see that this matrix can be formed so this is the
addition of both matrices now what about transpose because we also know how to
transpose a matrix we have not learned the multiplication but we know how to
transpose a matrix what is the transpose of a matrix so let's make a transpose so
4 transpose the command is if you want to transpose matrix a you simply type a
apostrophe and enter and as you can see here there the first row of a has become
the first column of this a transpose and because we have not assigned any
variable to this so this is stored in a variable answer so if you want for
example D as the a prime matrix so you can say D equals a prime now you will
get this matrix D which is the transpose of matrix a so this is how you transpose
a matrix so at this stage we only have learned so so much so but there are many
commands in which deal with the matrices and which
we will be learning in our next lectures