In the first lab of week 1 (Exercise 1), when we have to minimize the distances to find the best cluster centroid, according the formula we have to check the distances by ||x(i) - Uk || ** 2, to implement the same I used the following code

Allbeit there are some syntactical errors, ignoring them conceptually I can’t understand what’s wrong with this way, and the solution used something called norm from linear algebra, what is that and how is that related to the distance. Thanks you