Kardi Teknomo
Kardi Teknomo Kardi Teknomo Kardi Teknomo

Matrix Size & Validation
Vector Algebra
What is Vector?
Vector Norm
Unit Vector
Vector Addition
Vector Subtraction
Vector Scalar Multiple
Vector Multiplication
Vector Inner Product
Vector Outer Product
Vector Cross Product
Vector Triple Cross Product
Vector Triple Dot Product
Scalar Triple Product
Orthogonal & Orthonormal Vector
Cos Angle of Vectors
Scalar and Vector Projection
Matrix Algebra
What is a matrix?
Special Matrices
Matrix One
Null Matrix
Matrix Diagonal Is Diagonal Matrix?
Identity Matrix
Matrix Determinant
Matrix Sum
Matrix Trace
Matrix Basic Operation
Is Equal Matrix?
Matrix Transpose
Matrix Addition
Matrix Subtraction
Matrix Multiplication
Matrix Scalar Multiple
Hadamard Product
Horizontal Concatenation
Vertical Concatenation
Elementary Row Operations
Matrix RREF
Finding inverse using RREF (Gauss-Jordan)
Finding Matrix Rank using RREF
Matrix Inverse
Is Singular Matrix?
Linear Transformation
Matrix Generalized Inverse
Solving System of Linear Equations
Linear combination, Span & Basis Vector
Linearly Dependent & Linearly Independent
Change of basis
Matrix Rank
Matrix Range
Matrix Nullity & Null Space
Eigen System
Matrix Eigen Value & Eigen Vector
Symmetric Matrix
Matrix Eigen Value & Eigen Vector for Symmetric Matrix
Similarity Transformation and Matrix Diagonalization
Matrix Power
Orthogonal Matrix
Spectral Decomposition
Singular Value Decomposition
Resources on Linear Algebra

Matrix Size & Validation

(How to use the interactive programs in this tutorial)

By Kardi Teknomo, PhD.

<Next | Previous | Index>

In this page, I will explain how you will input and validate the size of a matrix or a vector in the interactive programs of this Linear Algebra tutorial.

First, your input must be numbers (real or integer), or a sequence of numbers (not string of words or other characters) separated by commas, or space or semicolon.

  • Use period to separate decimal part from the whole number.
  • Comma or space is used to separate numbers in a row. Comma does not represent a thousand.
  • Semicolon is used to separate rows


  • you should write 1112.25 and not 1,112.25
  • You should not write 1112,25 as a number because the program will interpret it as two numbers of 1112 and 25.

As an alternative form, you may also use space to replace comma.

1 2  3, 4       5

It is equivalent to
1, 2, 3, 4, 5;

When you input the sequence of numbers above, you will get
vector example

A vector or a matrix will have several rows. When you want to write a sequence of numbers on different rows, use semi colon to separate each rows. The last row’s semicolon is optional.  A matrix or a vector is defined by its size that is the number of rows and the number of columns. We always write matrix size as number of rows first and then the number of columns.

A vector is always a column vector (with only one column). Thus, instead of comma, you need to use semicolon to separate each entry.

30; 45; 60

It will produce

example column vector

When you want to write a row vector (consists only one row), you separate the numbers by commas.

30, 45, 60

It will produce

example row vector

A matrix may have several rows and several columns. You can write a matrix or a vector as sequence of numbers, separated by commas in a row and semicolon to mark the end of each row. Optionally, you can also write it in a nice format using carriage return.

30, 30, 60; 45, 30, 60; 30, 45, 15; 60, 180, 120;

It is equivalent to
30, 30, 60;
45, 30, 60;
30, 45, 15;
60, 180, 120;

Both of them will produce

example matrix

A matrix must have equal number of entries for all rows. If you mistype the entries, the program will accept it not as a matrix and the matrix or vector operations on your input will produce error or wrong answer. That is why you need to validate your input in the interactive program below.

1,  , 3; 4, 5, 6; , 8
It will produce
example wrong input

It shows that the first row has 2 entries, the second row has 3 entries and the third row has 1 entry.  Empty space between commas is not considered as an entry. Since the numbers of entries in each row are not equal, the matrix size cannot be determined.

Report in rational format

Some of the interactive programs in this linear algebra tutorial may have options to show the output as approximate fractional format. If you click the random example button, you may obtain a number in with several decimal digits. If you checkreport in rational format , the result will be in fraction. To separate the whole number from the fraction, the program is using under bar.

-2.25, 100.33333, 0.5, -51.125;

It will produce

Example vector in rational format

Now you are ready to play around with this exciting linear algebra tutorial, you may use the Next and Previous Navigation or go directly from the left navigation bar, or you can go back to the index of this tutorial.

<Next | Previous | Index>

Rate this tutorial or give your comments about this tutorial

This tutorial is copyrighted.

Preferable reference for this tutorial is

Teknomo, Kardi (2011) Linear Algebra tutorial. http:\\people.revoledu.com\kardi\ tutorial\LinearAlgebra\


© 2007 Kardi Teknomo. All Rights Reserved.
Designed by CNV Media