Question
1) Use the above function (you will need to add on to it) to solve for the following equations Ax=b in 50 unknowns, where A
1) Use the above function (you will need to add on to it) to solve for the following equations Ax=b in 50 unknowns, where A is a 50x50 matrix, b is a vector of size 50x1. Note that these are random matrices below, meaning each of you will get different answers for the solution. Verify your solution by multiplying A with your solution x.
m=50
A = npr.randint(0,2, [m,m]) b = npr.randint(0,2,[m,1])
2)Let A be a matrix, whose columns are (1,2,-1, 5), (2,0,-1, 3), and (4, -2, 1, 1)
Find out if the vector (1,1,1,1) can be written as a linear combination of the columns of A.
3) In this problem, you will find the inverse of A (from problem 1). For reasons you will learn in grad school, random matrices like A in problem 1 usually provide matrices with a full set of pivots. We saw in class that A has a full set of pivots iff Ax=b has a solution for all b.
Therefore, to find the inverse of A, we solve 1. Ax_1 = (1, 0,... 0). The vector x_1 becomes the first column of inv(A). 2. Ax_2 = (0, 1, ...0) (1 in the second position, zero elsewhere). The vector x_2 becomes the second column of inv(A). 3. A x_50 = (0,0,...,1) (1 in the last position, zero elsewhere). The vector x_50 becomes the last column of inv(A).
Use this approach (of course, do not manually solve 50 times, write a program for that) to find the inverse of A in problem 1. Call the inverse matrix invA (we will use this in later problems). Therefore, you are finding a matrix A @ invA = np.identity(50).
** Take advantage of the functions above (the matrices for elementary row operations).
This approach (but in a slightly more elegant implementation) is called the Gauss-Jordan method to find an inverse.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started