求解非方阵中的线性方程组

发布于 2024-12-12 01:20:23 字数 1455 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

不必在意 2024-12-19 01:20:23

矩阵是否为方阵并不决定解空间。矩阵的秩与列数之比决定了这一点(请参阅秩无效定理)。一般来说,线性方程组可以有零个、一个或无限多个解,具体取决于其秩和无效关系。

但是,要回答您的问题,您可以使用高斯消去法来查找矩阵的秩,如果这表明存在解,则找到特定的解 x0 和矩阵的零空间 Null(A)。然后,您可以将所有解决方案描述为 x = x0 + xn,其中 xn 表示 Null(A) 的任何元素。例如,如果矩阵是满秩的,则其零空间将为空,并且线性系统最多有一个解。如果它的秩也等于行数,那么您就有一个唯一的解决方案。如果零空间为一维,那么您的解将是一条穿过 x0 的线,该线上的任何点都满足线性方程。

Whether or not your matrix is square is not what determines the solution space. It is the rank of the matrix compared to the number of columns that determines that (see the rank-nullity theorem). In general you can have zero, one or an infinite number of solutions to a linear system of equations, depending on its rank and nullity relationship.

To answer your question, however, you can use Gaussian elimination to find the rank of the matrix and, if this indicates that solutions exist, find a particular solution x0 and the nullspace Null(A) of the matrix. Then, you can describe all your solutions as x = x0 + xn, where xn represents any element of Null(A). For example, if a matrix is full rank its nullspace will be empty and the linear system will have at most one solution. If its rank is also equal to the number of rows, then you have one unique solution. If the nullspace is of dimension one, then your solution will be a line that passes through x0, any point on that line satisfying the linear equations.

清风挽心 2024-12-19 01:20:23

好的,首先:非平方方程组可以有一个精确解,

[ 1 0 0 ][x] = [1]
[ 0 0 1 ][y]   [1]
         [z] 

显然有一个解(实际上,它有一个一维解族:x=z=1)。即使系统是超定而不是欠定,它仍然可能有一个解:

[ 1 0 ][x] = [1]
[ 0 1 ][y]   [1]
[ 1 1 ]      [2]

(x=y=1)。您可能想首先查看最小二乘求解方法,如果存在,则找到精确解,如果不存在,则找到“最佳”近似解(在某种意义上)。

Ok, first off: a non-square system of equations can have an exact solution

[ 1 0 0 ][x] = [1]
[ 0 0 1 ][y]   [1]
         [z] 

clearly has a solution (actually, it has an 1-dimensional family of solutions: x=z=1). Even if the system is overdetermined instead of underdetermined it may still have a solution:

[ 1 0 ][x] = [1]
[ 0 1 ][y]   [1]
[ 1 1 ]      [2]

(x=y=1). You may want to start by looking at least squares solution methods, which find the exact solution if one exists, and "the best" approximate solution (in some sense) if one does not.

红墙和绿瓦 2024-12-19 01:20:23

采用 Ax = b,其中 A 有 m 列和 n 行。我们不能保证有且只有一个解,这在许多情况下是因为我们的方程多于未知数(m 大于 n)。这可能是因为重复测量,这是我们真正想要的,因为我们对噪声的影响持谨慎态度。

如果我们发现无法找到解决方案,则实际上意味着无法找到 b 在 A 所跨越的列空间中移动。 (因为 x 仅采用列的组合)。

然而,我们可以要求 A 所跨越的空间中最接近 b 的点。我们怎样才能找到这样一个点呢? 在平面上行走,最接近平面外的一点,就是一直走到你的正下方。从几何角度来说,这是我们的视线垂直于平面的情况。

现在我们可以用数学公式来表达这一点。垂直向量让我们想起正交投影。这就是我们要做的。最简单的情况告诉我们做aT b。但我们可以采用整个矩阵AT b

对于我们的方程,让我们对两边应用变换:AT Ax = AT b
最后一步是通过AT A 的逆来求解 x:

x = (ATA)^-1 * AT b

Taking Ax = b, with A having m columns and n rows. We are not guaranteed to have one and only one solution, which in many cases is because we have more equations than unknowns (m bigger n). This could be because of repeated measurements, that we actually want because we are cautious about influence of noise.

If we observe that we can not find a solution that actually means, that there is no way to find b travelling the column space spanned by A. (As x is only taking a combination of the columns).

We can however ask for the point in the space spanned by A that is nearest to b. How can we find such a point? Walking on a plane the closest one can get to a point outside it, is to walk until you are right below. Geometrically speaking this is when our axis of sight is perpendicular to the plane.

Now that is something we can have a mathematical formulation of. A perpendicular vector reminds us of orthogonal projections. And that is what we are going to do. The simplest case tells us to do a.T b. But we can take the whole matrix A.T b.

For our equation let us apply the transformation to both sides: A.T Ax = A.T b.
Last step is to solve for x by taking the inverse of A.T A:

x = (A.T A)^-1 * A.T b

暗喜 2024-12-19 01:20:23

最小二乘建议是一个非常好的建议。

我要补充的是,您可以尝试奇异值分解(SVD),它将为您提供尽可能最好的答案,并免费提供有关零空间的信息。

The least squares recommendation is a very good one.

I'll add that you can try a singular value decomposition (SVD) that will give you the best answer possible and provide information about the null space for free.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文