Implementing recommendation sys

Hi, in recommendation system Jeremy explain how the unknown values are filled by doing a gradient descent on 2 random matrices.
But generally in gradient descent we will have an array of constants and and an array of variables and we’ll update the variables to fit the constants.
But in the this case both the matrices are random and have to updated.
How do I implement this?