You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here ${\mathcal C}$ denotes a column space, ${\mathcal N}$ denotes a null space, and ${\mathcal R}$ denotes a row space.
176
177
177
-
Collection {eq}`eq:fourspaceSVD` asserts that
178
+
Since $U$ and $V$ are both orthonormal matrices, collection {eq}`eq:fourspaceSVD` asserts that
178
179
179
180
* $U_L$ is an orthonormal basis for the column space of $X$
181
+
* $U_R$ is an orthonormal basis for the null space of $X^T$
182
+
* $V_L$ is an orthonormal basis for the row space of $X$
180
183
* $V_R$ is an orthonormal basis for the null space of $X$
181
-
* $V_L$ is an orthonormal basis for the range space of $X$
182
-
* $U_R$ is an orthonormal basis for the column space of $X^T$
184
+
183
185
184
186
The four claims in {eq}`eq:fourspaceSVD` can be verified by performing the multiplications called for by the right side of {eq}`eq:fullSVDpartition` and interpreting them.
185
187
186
188
Although we won't go through the details of that verification here, we will note that the claims in {eq}`eq:fourspaceSVD` and the fact that $U$ and $V$ are both unitary (i.e, orthonormal) matrices immediately implies
187
189
that
188
190
189
-
* the column space of $X$ is orthogonal to the column space of of $X^T$
190
-
* the null space of $X$ is orthogonal to the range space of $X$
191
+
* the column space of $X$ is orthogonal to the null space of of $X^T$
192
+
* the null space of $X$ is orthogonal to the row space of $X$
191
193
192
194
Sometimes these properties are described with the following two pairs of orthogonal complement subspaces:
193
195
@@ -196,6 +198,49 @@ Sometimes these properties are described with the following two pairs of orthogo
196
198
197
199
198
200
201
+
Let's do an example.
202
+
203
+
```{code-cell} ipython3
204
+
np.set_printoptions(precision=2)
205
+
206
+
# Define the matrix
207
+
A = np.array([[1, 2, 3, 4, 5],
208
+
[2, 3, 4, 5, 6],
209
+
[3, 4, 5, 6, 7],
210
+
[4, 5, 6, 7, 8],
211
+
[5, 6, 7, 8, 9]])
212
+
213
+
# Compute the SVD of the matrix
214
+
U, S, V = np.linalg.svd(A,full_matrices=True)
215
+
216
+
# Compute the rank of the matrix
217
+
rank = np.linalg.matrix_rank(A)
218
+
219
+
# Print the rank of the matrix
220
+
print("Rank of matrix:\n", rank)
221
+
print("S: \n", S)
222
+
223
+
# Compute the four fundamental subspaces
224
+
row_space = U[:, :rank]
225
+
col_space = V[:, :rank]
226
+
null_space = V[:, rank:]
227
+
left_null_space = U[:, rank:]
228
+
229
+
230
+
print("U:\n", U)
231
+
print("Column space:\n", col_space)
232
+
print("Left null space:\n", left_null_space)
233
+
print("V.T:\n", V.T)
234
+
print("Row space:\n", row_space.T)
235
+
print("Right null space:\n", null_space.T)
236
+
```
237
+
238
+
239
+
240
+
241
+
242
+
243
+
199
244
## Properties of Full and Reduced SVD's
200
245
201
246
Up to now we have described properties of a **full** SVD in which shapes of $U$, $\Sigma$, and $V$ are $\left(m, m\right)$, $\left(m, n\right)$, $\left(n, n\right)$, respectively.
0 commit comments