透過 MCP 連接 →

輸入計算

數學公式

廣告

結果

x = 2
y = 3
z = -1
以克拉瑪公式求解
行列式 數值
det(A) -1
det(Aₓ) -2
det(A_y) -3
det(A_z) 1

這個計算機的功能

本工具運用克拉瑪公式(Cramer's Rule),求解含有三個未知數(x、y、z)的三元一次方程組。請依照下列標準式輸入每個方程式的係數:

$$a_1 x + b_1 y + c_1 z = d_1$$
$$a_2 x + b_2 y + c_2 z = d_2$$
$$a_3 x + b_3 y + c_3 z = d_3$$

計算機會算出係數矩陣的行列式,以及三個替換後的行列式,並回傳 x、y、z 的精確解。

使用方式

在每一列輸入四個數字:三個係數(a、b、c)以及等號右側的常數項(d)。負數與小數皆可使用。結果區會顯示解答,同時列出 \(\det(A)\)、\(\det(A_x)\)、\(\det(A_y)\) 與 \(\det(A_z)\),方便您自行驗算過程。

公式說明

克拉瑪公式指出:對於方程組 \(A \cdot v = d\),只要係數矩陣的行列式不為零,每個未知數都可以這樣求得——把 A 中對應的那一行替換成常數向量 d,計算該行列式,再除以 \(\det(A)\)。因此 \(x = \det(A_x)/\det(A)\),y、z 的求法也相同。整體公式為:

$$x = \frac{D_x}{D}, \quad y = \frac{D_y}{D}, \quad z = \frac{D_z}{D}$$ $$\text{where}\quad \left\{ \begin{aligned} D &= \begin{vmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{vmatrix} \\[0.4em] D_x &= \begin{vmatrix} d_1 & b_1 & c_1 \\ d_2 & b_2 & c_2 \\ d_3 & b_3 & c_3 \end{vmatrix} \\[0.4em] D_y &= \begin{vmatrix} a_1 & d_1 & c_1 \\ a_2 & d_2 & c_2 \\ a_3 & d_3 & c_3 \end{vmatrix} \\[0.4em] D_z &= \begin{vmatrix} a_1 & b_1 & d_1 \\ a_2 & b_2 & d_2 \\ a_3 & b_3 & d_3 \end{vmatrix} \end{aligned} \right.$$

若 \(\det(A) = 0\),方程組就沒有唯一解,此時無法套用克拉瑪公式。

Advertisement
Diagram showing Cramer's rule with matrix A and three modified matrices A1, A2, A3 where each column is replaced by the constants vector b
Cramer's Rule replaces one column of A with the constants vector b to form A1, A2, and A3.

範例演算

求解:\(2x + y - z = 8\);\(-3x - y + 2z = -11\);\(-2x + y + 2z = -3\)。

\(\det(A) = -1\),\(\det(A_x) = -2\),\(\det(A_y) = 3\),\(\det(A_z) = -1\)。因此 \(x = \frac{-2}{-1} = 2\),\(y = \frac{3}{-1} = -3\)⋯⋯精確計算後得:\(x = 2\)、\(y = 3\)、\(z = -1\)。代回驗算:\(2(2) + 3 - (-1) = 4 + 3 + 1 = 8\) ✓。

Three intersecting planes meeting at a single point in 3D space representing the unique solution of a 3x3 linear system
Each equation is a plane; their single common intersection point is the solution (x, y, z).

常見問題

如果 \(\det(A)\) 等於零怎麼辦?此時方程組不是無解,就是有無限多組解;克拉瑪公式必須在行列式不為零時才能使用,因此計算機會特別標示這種情況。

可以輸入小數或分數嗎?小數可直接輸入。若要輸入分數,請先換算成小數(例如 \(1/2 = 0.5\))。

克拉瑪公式的效率好嗎?對於三元(3x3)方程組而言,它快速又精確。但若是更大型的方程組,通常會改用高斯消去法(Gaussian elimination)較有效率。

最後更新: