0% found this document useful (0 votes)
7 views3 pages

MATLAB Assignment 2 Instructions and Tasks

Uploaded by

baovo12345
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

MATLAB Assignment 2 Instructions and Tasks

Uploaded by

baovo12345
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MATLAB Assignment 2

Due Wednesday, March 8 at 11:59 PM EDT (Maryland time) on Gradescope


Instructions:
On ELMS, see the file MATLAB [Link] to learn how to get MATLAB and do some
basic commands first. You may work with up to two other people (groups of three total).
If you choose to work together, you may simply submit one copy, and everyone will be
receiving the same grade. Make sure to include all names when submitting to
Gradescope!
Submitting: To get an idea of what you should be submitting, you can first download
the file Example Matlab File.m in the Files section. Open it in Matlab. Then at the top of
the program, click on the PUBLISH tab. Click on the Publish button, and it should output
an html file with all the code/output. This format is what your Matlab assignment should
look like. When you are done with the actual Matlab project, click the Publish button, save
this as a PDF, and upload this to Gradescope. There is a tab on ELMS that links you
to Gradescope. Remember to separate each problem by a section using the double
percent signs. Even if you have the correct code, if there is no output, you will NOT
receive full credit!
(separate problems by using double percent signs as shown in the example file!!!!)
1. Use format short.
(a) Define a matrix A that would rotate a point in R2 counterclockwise
  about the
2
origin by an angle θ = π/3. Use this to transform the vector v = .
5
(b) Define a 2 × 2 matrix B that would expand the x-coordinate
  of a point by scaling
2
it 8 units. Use this to transform the vector v = .
5
(c) If T1 and T2 denotes the transformations above, respectively, find the matrix rep-
resentation of the transformations that first rotates, then scales, and find the
matrix representation of the transformations that first scales then rotates. Equiv-
alently, compute the composition of the transformations T1 ◦ T2 and T2 ◦ T1 i.e.
find AB and BA.
(d) What can be said about the commutative property when applying multiple trans-
formations to a point? You can use disp or fprintf to briefly explain this.
2. Use format rat.
Consider the following system of equations
7x1 + 4x2 − 5x3 = 4
10x1 + 4x2 = −8
−5x1 − 6x2 + x3 = 3.

1
(a) Define the matrix A to be the coefficient matrix, and use inv to find its inverse.
(b) Define an appropriate matrix, and use matrix multiplication with part (a) to find
the unique solution to the system.
(c) We now find the inverse using the algorithm from class. Construct the augmented
matrix with the identity matrix by copying the following
1 X=[A eye ( 3 ) ] ;
Compute the RREF of X, and denote this matrix by Y .
(d) Use appropriate commands to extract the correct columns from Y that would
represent the inverse of A (see item 12 in the MATLAB [Link]). Denote this
matrix by inverse.

3. Use format rat.

(a) Define the following matrix:


 
6 4 2 2 4
2
 2 −3 2 1 

−1 −5 1 1 −3
A= 
−4 −6 1 0 −5
4 2 7 4 0

(b) Use Matlab to compute det(A).


(c) Knowing the previous part, without using Matlab, compute det(A−1 ). Use
disp or fprintf to briefly explain how you concluded this.
(d) Now suppose  
1 0 0 0 0
30 2 0 0 0
 
B=
 4 2 −2 0 0.

3 7 7 2 0
7 −3 −8 1 1
Determine det (A−2 B 2 ) without the use of Matlab. Use disp or fprintf CLEARLY
explain what properties you applied.

4. (a) Create 3 × 3 matrices A and B such that neither is the zero matrix such
that (they are NOT equal)
(AB)2 6= A2 B 2 .
Compute (AB)2 in one line of code first, then A2 B 2 in another line.
(b) Repeat part (a) now with matrices C and D such that (they ARE equal)

(CD)2 = C 2 D2 .

2
(c) If A and B are 2 × 2 matrices, is it possible for A and B to be both invertible,
but A + B to be NOT invertible? If it is impossible, briefly explain why. If it
IS possible, provide explicit examples of matrices, and justify your reasoning
using determinants.

5. (Use format rat) Let  


2x + 1 x x+2
A =  x + 2 −2x −x − 3 .
2x − 1 x 3x

(a) Use the syms command to symbolically define the variable x.


(b) Look up how to use the solve command for Matlab. Use this, along with the
det to find all values of x for which A does NOT have an inverse.
(c) For any integer k > 3, determine all values of x for which Ak will NOT have an
inverse. Use disp or fprintf to explain how you deduced your answer. Hint: Use
properties of determinants.

Common questions

Powered by AI

In MATLAB, after defining matrices C and D, use code to compute (CD) and square it. Separately, compute C^2 and D^2, and multiply these results. The equality (CD)^2 = C^2D^2 holds when matrices commute, which is usually seen in special cases such as identity matrices, or when matrix dimensions, elements, and multiplication behavior align mathematically .

Commutativity absence in matrix multiplication is manifest when composing transformations like rotation and scaling in MATLAB. This allows students to explore and understand non-commutative operations' impact on outcomes, emphasizing the need to consider transformation order critically. Such tasks illustrate key linear algebra principles, challenging students to internalize when operations may or may not commute .

Using MATLAB's symbolic computation, one can define a matrix parameter symbolically and apply 'det' and 'solve' functions to find parameter values that result in a non-invertible matrix. For instance, for a matrix A = f(x), use 'syms' to define x and 'solve(det(A), x)' to find all x that make det(A) = 0, indicating non-invertibility .

A and B being invertible doesn't ensure A + B is invertible due to the potential cancellation effect. For example, A = I and B = -I are invertible (identity matrix and negative identity), but A + B = 0, which is non-invertible because its determinant is zero. This illustrates how matrix sum invertibility requires careful consideration beyond individual matrices .

Incorrect ordering of transformations in MATLAB, such as reversing rotation and scaling order, leads to different mathematical outcomes due to non-commuting operations. This impacts educational outcomes by highlighting the importance of understanding operation order effects, reinforcing deeper concepts in linear algebra and fostering meticulous procedural understanding critical for academic progression .

'format rat' in MATLAB represents numbers as fractions, providing exact rational numbers instead of decimal approximations. This is beneficial in contexts where precision is paramount, such as solving certain algebraic equations or when dealing with inherently rational operations, minimizing round-off errors and ensuring result exactness .

To determine det(A−2B2) for matrices A and B without computation tools, one would use properties such as linearity and scaling of determinants. Use the fact that det(kB) = k^n det(B) for an n×n matrix. Factor the terms and utilize determinants' properties: det(A−2B^2) = det(A) - 2^n(det(B))^2. This approach hinges on understanding these properties deeply .

The invertibility of a matrix hinges on its determinant being non-zero. If det(A) = 0, A is non-invertible. For any integer k, the matrix A^k is non-invertible if det(A) = 0 for some eigenvalue x, because det(A^k) = (det(A))^k. Understanding this property allows for determining invertibility without directly computing large matrix powers .

Matrix multiplication can represent linear transformations such as rotation and scaling. A rotation matrix A for an angle θ = π/3 in R2 is used to rotate a vector, and a scaling matrix B expands coordinates by a factor (e.g., x-coordinate by 8). When composing these transformations, the order affects the result: T1 ◦ T2 (rotate then scale) results in AB, whereas T2 ◦ T1 (scale then rotate) gives BA. This demonstrates that, in general, matrix multiplication is not commutative, and the order of applying transformations matters .

To find the inverse of a matrix in MATLAB, you use the 'inv' function. First, define the coefficient matrix A of the system of equations. Using 'inv(A)', compute the inverse, and multiply it by the constants vector to find the unique solution. Alternatively, form an augmented matrix [A eye(size(A))], compute its Reduced Row Echelon Form (RREF), and extract the inverse from this result .

You might also like