# Math 753/853 HW3: LU decomposition, no pivoting¶

Problem 1. Write a function named ludecomp that computes the LU decomposition of a square matrix $A$ and returns a lower-triangular matrix $L$ and an upper-triangular matrix $U$ such that $A=LU$.

In [ ]:



Test your LU decomposition function on a random 5 x 5 matrix. Use Julia's randn function to generate the random matrix with normally distributed elements.

In [ ]:



Problem 2. Write a forwardsub function that does forward substitution forward to solve $Ly=b$ for lower-triangular $L$.

In [ ]:



Test your forwardsub function on a known $Ly=b$ problem. That is, construct a lower-triangular $L$ and a random $y$ vector and multiply them together to get a vector $b$. Then use forwardsub to solve $Ly=b$ for $y$ given $L$ and $b$, and verify that you get the $y$ you started with.

In [ ]:



Problem 4. Write a backwardsub function that does backward substitution forward to solve $Ux=y$ for upper-triangular $U$. Test it in a similar manner as your test for forwardsub.

In [ ]:



Problem 5. Write an lusolve function that solves $Ax=b$ for $x$ using ludecomp, forwardsub, and backwardsub. Test it on a problem of your choosing.

In [ ]: