使用消元法求解线性方程
如果一个方程写成 ax + by + c = 0 的形式,其中 a、b 和 c 是实整数,并且 x 和 y 的系数即 a 和 b 不等于 0,则称其为两个变量的线性方程。例如,3x + y = 4 是包含两个变量 x 和 y 的线性方程。这些变量之前的数字称为系数。因此,x 的系数为 3,y 的系数为 1。
使用消元法的线性方程
在消除法中,您可以添加或减去方程以获得一个变量中的方程。当一个变量的系数具有不同的符号(一个方程为负,另一个为正)时,您可以添加方程以消除一个变量,并且当一个变量的系数具有相同的符号(两个方程为负或为正)两个方程),你减去方程来消除一个变量。需要注意的是,要消除的变量需要在两个方程中具有相同的系数。
求解一对线性方程组的消元法如下所示,其步骤如下:
广义示例
假设我们有两个形式为 ax + by = c 和 mx + ny = q 的方程。
Given:
ax + by = c ⇢ (1)
mx + ny = q ⇢ (2)
In order to solve the given equations by elimination, the coefficients of one of the variables must be equal. Therefore, we multiply equation (1) by m and equation (2) by a in order to equate the coefficients of x.
amx + bmy = cm
amx + any = aq
Subtracting the two equations, we obtain:
(amx – amx) + (bmy – any) = cm – aq
⇒ y(bm – an) = cm – aq
⇒ y = (cm – aq)/(bm – an)
The equation (1) can be re- written as x = c – by/a. Now substitute y = (cm – aq)/(bm – an) in the equation, x = c – by/a.
使用消元法求解线性方程的步骤
- 确保线性方程的形式为 ax + by = m 和 cx + dy = n。
- 为了通过消元法求解给定方程,两个方程中变量之一的系数必须相等。寻找数字,当乘以给定方程的系数时,会使它们相等。就像我们将上述方程与 m 和 a 相乘,以便通过在方程一中将其系数从 a 更改为 am 并在第二个方程中从 m 更改为 am 来消除 x。
- 添加或减去方程以消除具有相等系数的变量。在上面的例子中,变量 x 被消除了。
- 求解另一个变量的值。在上面的例子中,在消除 x 之后,计算出 y 的值。
- 将变量的值代入任何给定的方程,并求解之前消除的变量。
示例问题
问题 1:使用消去法求解 2x + y = 3 和 6x - y = 9。
解决方案:
Given:
2x + y = 3 ⇢ (1)
6x − y = 9 ⇢ (2)
In order to solve the given equations by elimination, the coefficients of one of the variables must be equal. Therefore, multiply the first equation by -3,and multiply the second equation by 1.
−6x − 6y = −9
6x − 3y = 9
Add these equations to eliminate x:
−9y = 0
⇒ y = 0
Substitute y = 0 in equation (1):
2x + 0 = 3
⇒ x = 3/2
Thus, by elimination method, x = 3/2 and y = 0.
问题 2:用消去法求解 4x + 2y = 10, 5x - y = 4 。
解决方案:
Given:
4x + 2y =10 ⇢ (1)
5x − y = 4 ⇢ (2)
In order to solve the given equations by elimination, the coefficients of one of the variables must be equal. Therefore, multiply the first equation by 1,and multiply the second equation by 2.
4x + 2y = 10
10x – 2y = 8
Add these equations to eliminate y:
14x = 18
⇒ x = 18/14
⇒ x = 9/7
Substitute x = 9/7 in equation (1):
2x + 0 = 3
⇒ 4(9/7) + 2y = 10
⇒ y = 17/7
Thus, by elimination method, x = 9/7 and y = 17/7.
问题 3:用消去法求解 9a + 2b = 6, 4a - 7b = 2。
解决方案:
Given:
9a + 2b = 6 ⇢ (1)
4a − 7b = 2 ⇢ (2)
In order to solve the given equations by elimination, the coefficients of one of the variables must be equal. Therefore, multiply the first equation by 7,and multiply the second equation by 2.
63a + 14b = 42
8a − 14b = 4
Add these equations to eliminate b:
71a = 46
⇒ a = 46/71
Substitute a = 46/71 in equation (1):
9(46/71) + 2b = 6
⇒ b = 6/71
Thus, by elimination method, a = 46/71 and b = 6/71.
问题4:求解:3u + 2t = 8; 5u + 9t = 2 使用排除法。
解决方案:
Given:
3u + 2t = 8 ⇢ (1)
5u + 9t = 2 ⇢ (2)
In order to solve the given equations by elimination, the coefficients of one of the variables must be equal. Multiply the first equation by 5,and multiply the second equation by −3.
10t + 15u = 40
−27t − 15u = −6
Add these equations to eliminate u:
−17t = 34
⇒ t = −2
Substituting t = −2 in equation (1), we have:
3u + 2(−2) = 8
⇒ 3u = 12
⇒ u = 4
Thus, by elimination method, t = −2 and u = 4.
问题 5:用消去法求解 7p + 4q = 7, 8p + 5q = 5。
解决方案:
Given:
3u + 2t = 8 ⇢ (1)
5u + 9t = 2 ⇢ (2)
In order to solve the given equations by elimination, the coefficients of one of the variables must be equal. Multiply the first equation by 5, and multiply the second equation by −4.
35p + 20q = 35
−32p − 20q = −20
Add these equations to eliminate q:
3p = 15
⇒ p = 15/3
⇒ p = 5
Substituting p = 5 in equation (1), we have:
7(5) + 4q = 7
⇒ 4q = -28
⇒ q = -7
Thus, by elimination method, p = 5 and q = -7.