Question

4. Suppose you had n matrices with dimensions: ai xbi ,a2 x b2. . . . ,a,, X bn. Your goal is to determine, given two integer

Please show work clearly. Thanks

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Problem is simple and interesting. Given the sequence of n matrices and we want to whether it is possible to obtain matrix of dimension say s x t. In order to solve this problem, we will create a directed graph G=(V,E) where number of vertices in V will be equal to number of distinct integers in set S = {a1, b1, a2, b2, .....,an,bn} . Thus let there be m distinct values in the given set S and hence we have vertices V={v1, v2,...,vm } which are distinct integers in set S.

Now we will create a directed edge (u,v) if and only if there is some matrix in the given matrix set with the dimension u x v.

Since there are n matrices, so we will get n edges.

Claim 1 :- It is possible to obtain matrix of dimension s x t if and only if there exist a directed path from vertex s to vertex t.

Proof :- If there exist path from vertex s to vertex t, this means by following the set of edges in the path we will be able to reach vertex t and equivalently by taking the product of matrices corresponding to the edges in path from s to t, we will be able to get matrix of dimension s x t. Similarly if it is possible to obtain matrix of dimension s x t, then by taking the edges corresponding to the matrices in multiplication , we will be able to obtain path from s to t.

Hence finding matrix of dimension s x t is equivalent to finding path from s to t in graph G = (V,E ) and path from s to t can be found using algorithm like Breadth First Search with starting vertex s. If there exist directed path from s to t then vertex t will be in BFS tree with root vertex s.

Since |E|=n, and |V|<= 2n, so creating graph G=(V,E) will take O(n) time and doing BFS will also take O(n) time. And entire task will be done in O(n) time.

Please comment for any clarification.

Add a comment
Know the answer?
Add Answer to:
Please show work clearly. Thanks 4. Suppose you had n matrices with dimensions: ai xbi ,a2...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 15.2-1 -- Find an optimal parenthesization of a matrix-chain product whose sequence of dimensions is (5,...

    15.2-1 -- Find an optimal parenthesization of a matrix-chain product whose sequence of dimensions is (5, 10, 3, 12, 5, 50, 6). 5. -- Implement Matrix-ChainMultiply(A,s,i,j) using algorithm Matrix-Chain-Order and Matrix-Multiply, where Matrix-Multiply(X,Y, p,q,r) multiplies matrices X and Y, X and Y have pxq and qxr demension, respectively. Given a chain of 6 matrices whose dimensions are given in 15.2-1, and elements are random real numbers from -10 to 10, use Matrix-Chian-ultiply to calculate the product of these matrices.

  • The input consists of n numbers a1, a2, . . . , an and a target...

    The input consists of n numbers a1, a2, . . . , an and a target value t. The goal is to determine in how many possible ways can we add up two of these numbers to get t. Formally, your program needs to find the number of pairs of indices i, j, i < j such that ai+aj = t. For example, for 2, 7, 3, 1, 5, 6 and t = 7, we can get t in two...

  • READ CAREFULLY AND CODE IN C++ Dynamic Programming: Matrix Chain Multiplication Description In this assignment you...

    READ CAREFULLY AND CODE IN C++ Dynamic Programming: Matrix Chain Multiplication Description In this assignment you are asked to implement a dynamic programming algorithm: matrix chain multiplication (chapter 15.2), where the goal is to find the most computationally efficient matrix order when multiplying an arbitrary number of matrices in a row. You can assume that the entire input will be given as integers that can be stored using the standard C++ int type and that matrix sizes will be at...

  • Problem 5. Let n N. The goal of this problem is to show that if two real n x n matrices are simil...

    Problem 5. Let n N. The goal of this problem is to show that if two real n x n matrices are similar over C, then they are also similar over IK (a) Prove that for all X, y є Rnxn, the function f(t) det (X + ty) is a polynomial in t. (b) Prove that if X and Y are real n × n matrices such that X + ừ is an invertible complex matrix, then there exists a...

  • please answer the five questions clearly. I have provided the data. 7 Diagonal Matrices Diagonal Matrices...

    please answer the five questions clearly. I have provided the data. 7 Diagonal Matrices Diagonal Matrices If A = (a) is a square matrix, then the entries and are called diagonal entries. A square matrix is called diagonal if all non-diagonal entries are zeros. Explore what happens if we add, subtract or multiply diagonal matrices. A and B are the same matrices in previous sections ( section 5.) Type D-diag(diag(A)) to create a diagonal matrix from A. Type E-diag(diag(B)) to...

  • Meet is an operation between zero-one matrices and uses Boolean products (C. Join is an operation...

    Meet is an operation between zero-one matrices and uses Boolean products (C. Join is an operation between zero-one matrices and uses Boolean products d. Join is an operation between zero-one matrices and uses conjunctions 29. Given set S (-2, -1, 0, 1, 2), R is a relation on S. i. R ( (x, y)| x-y 1} Write R as a set of ordered pairs. (Use roster method to write R as a set of tuples) 3pts ill. and matrix representation...

  • Question A matrix of dimensions m × n (an m-by-n matrix) is an ordered collection of m × n elemen...

    Question A matrix of dimensions m × n (an m-by-n matrix) is an ordered collection of m × n elements. which are called eernents (or components). The elements of an (m × n)-dimensional matrix A are denoted as a,, where 1im and1 S, symbolically, written as, A-a(1,1) S (i.j) S(m, ). Written in the familiar notation: 01,1 am Gm,n A3×3matrix The horizontal and vertical lines of entries in a matrix are called rows and columns, respectively A matrix with the...

  • Question 4 [12 marks] Some applications of mathematics require the use of very large matrices (several...

    Question 4 [12 marks] Some applications of mathematics require the use of very large matrices (several thousand rows for example) and this in turn directs attention to efficient ways to manipulate them. This question focuses on the efficiency of matrix multiplication, counting the number of numerical arithmetic operations (addition, subtraction and multiplication) involved. We start with very simplest case of 2x2 matrices. (a) The standard way of multiplying 2x2 matrices uses 8 multiplications and 4 additions. List the 8 products...

  • Please provide detailed step-by-step solutions! Will give thumb-up for a good answer. Thank you! 4. Suppose...

    Please provide detailed step-by-step solutions! Will give thumb-up for a good answer. Thank you! 4. Suppose we want to multiply a chain of six matrices with dimensions 4-by-7,7-by-3, 3-by-2,2-by-6, 6-by-5,5-by-8, respectively. Trace the dynamic programming algorithm Matrix-Chain-Order in Section 15.2 of the Cormen textbook. Then determine which one of the following items has the correct value. a) m[3][6)-188 b) m[21161-296 c) m[1161 300 d) m[5]16] 248

  • please answer the following clearly and make sure it is correct 6. You are in possession of a pair of 4-sided fair dice...

    please answer the following clearly and make sure it is correct 6. You are in possession of a pair of 4-sided fair dice (green and red). If you roll any individual die, the possible results are 1, 2, 3, or 4, each equally likely. Let Ai be the random result on the green die, and A2 be the random result on the red die. We define the random variable A = A1 A2 the absolute value of difference between the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT