# حل أنظمة المعادلات الخطية

> Solve 2 to 5 simultaneous linear equations exactly by Gauss–Jordan elimination, with every row operation shown, and detect no-solution or infinite cases.

النسخة التفاعلية: https://www.calcopenly.com/ar/math/system-of-linear-equations-solver
الموضوع: حاسبات الرياضيات

A system of linear equations is written as an augmented matrix [A | b], one row per equation. Gauss–Jordan elimination scales each pivot row so the pivot is 1 and subtracts multiples of it from every other row until the coefficients form the identity matrix, leaving the solution in the last column. The arithmetic uses exact fractions, so 2x + 3y = 7, 4x − y = 1 gives x = 5/7 and y = 13/7 rather than rounded decimals.

Simultaneous equations come up in circuit analysis, mixture and pricing problems, and algebra courses. The default is the 3 × 3 example from Wikipedia's Gaussian elimination article, 2x + y − z = 8, −3x − y + 2z = −11, −2x + y + 2z = −3, with the unique solution x = 2, y = 3, z = −1.

By the Rouché–Capelli theorem the system has one solution when the rank of A equals the number of unknowns, infinitely many when A and [A | b] share a smaller rank, and none when their ranks differ.

## المدخلات

- **Equations as rows of numbers**: One equation per line: the coefficients, then the constant. 2 1 -1 8 means 2x + y − z = 8. A | or = before the constant is fine; fractions like 1/2 work.

## النتائج

- Solution — النتيجة الرئيسية
- Type of system
- x₁ (x)
- x₂ (y)
- x₃ (z)
- x₄
- x₅
- Determinant of the coefficients
- Condition number (∞-norm)

## الصيغة

$$
\begin{gathered} [A \mid \mathbf b] \xrightarrow{\text{row operations}} [I \mid \mathbf x] \\[10pt] \kappa_\infty(A) = \|A\|_\infty \, \|A^{-1}\|_\infty \end{gathered}
$$

## أمثلة محلولة

### Wikipedia 3×3 example

- Equations as rows of numbers: 2 1 -1 8 / -3 -1 2 -11 / -2 1 2 -3
- **Solution: x = 2, y = 3, z = −1**
- **x₁ (x): 2**
- **x₂ (y): 3**
- **x₃ (z): -1**
- **Determinant of the coefficients: -1**
- **Condition number (∞-norm): 60**
- مصدر التحقق: ⁨Wikipedia “Gaussian elimination” example; Python fractions: det = −1, ‖A‖∞ = 6, ‖A⁻¹‖∞ = 10⁩

### Fractional answer: 2x + 3y = 7, 4x − y = 1

- Equations as rows of numbers: 2 3 7 / 4 -1 1
- **Solution: x = 5/7, y = 13/7**
- **x₁ (x): 0.7142857143**
- **Determinant of the coefficients: -14**
- مصدر التحقق: ⁨Python fractions: x = 10/14, y = 4x − 1 = 13/7⁩

### Inconsistent: x + y = 1, 2x + 2y = 3

- Equations as rows of numbers: 1 1 1 / 2 2 3
- **Type of system: No solution — the equations are inconsistent**
- **Solution: No solution**
- مصدر التحقق: ⁨2 × (first) gives 2x + 2y = 2 ≠ 3⁩

### Dependent equations (edge case)

- Equations as rows of numbers: 1 1 1 6 / 2 2 2 12 / 1 -1 0 0
- **Type of system: Infinitely many solutions**
- **Solution: x = 3 − t/2, y = 3 − t/2, z = t**
- **Determinant of the coefficients: 0**
- مصدر التحقق: ⁨Row 2 = 2 × row 1; x = y and 2y + z = 6 (hand elimination)⁩

### 4×4 system

- Equations as rows of numbers: 2 1 -1 3 9 / 1 -3 2 1 17 / 3 2 1 -1 -2 / 1 1 1 1 6
- **Solution: x₁ = 1, x₂ = −2, x₃ = 3, x₄ = 4**
- **x₄: 4**
- مصدر التحقق: ⁨Constants built from x = (1, −2, 3, 4); Python fractions Gauss–Jordan confirms the unique solution⁩

## الأسئلة

### How do you solve a system of three equations with three unknowns?

Eliminate one variable at a time. Gauss–Jordan elimination writes the equations as a matrix, turns the first coefficient into 1, subtracts multiples of that row to clear x from the other equations, then repeats for y and z. For the default system three rounds of row operations leave x = 2, y = 3, z = −1; substituting into 2x + y − z = 8 gives 4 + 3 + 1 = 8.

### How can you tell if a system has no solution or infinitely many?

Row-reduce it and look at rows whose coefficients all become 0. A row reading 0 = 1, or 0 equal to any non-zero number, means no solution: x + y = 1 and 2x + 2y = 3 are parallel lines. A row reading 0 = 0 means one equation repeats another, leaving a free variable and infinitely many solutions. With as many equations as unknowns, a determinant of 0 signals one of these two cases.

### What is Cramer's rule?

Cramer's rule gives each unknown as a ratio of determinants: x = det(Aₓ)/det(A), where Aₓ is A with its x column replaced by the constants. For 2x + 3y = 7, 4x − y = 1, det(A) = 2 × (−1) − 3 × 4 = −14 and det(Aₓ) = 7 × (−1) − 3 × 1 = −10, so x = 10/14 = 5/7. It needs det(A) ≠ 0 and much more arithmetic than elimination beyond 3 × 3.

### What is the difference between Gaussian and Gauss–Jordan elimination?

Gaussian elimination stops at row echelon form, a triangular matrix, and finds the unknowns by back-substitution from the last equation upward. Gauss–Jordan continues until the coefficients form the identity matrix, so each row reads off one unknown directly. Gauss–Jordan takes about n³ arithmetic operations for n equations against about 2n³/3, in exchange for skipping the substitution step.

### What does the condition number of a system mean?

It bounds how much a small relative change in the coefficients or constants can grow in the solution. The ∞-norm version is κ = ‖A‖∞ × ‖A⁻¹‖∞; for the default system ‖A‖∞ = 6 and ‖A⁻¹‖∞ = 10, so κ = 60. As a rule of thumb about log₁₀ κ significant digits are lost, here about 2, and a value near 10¹² means the equations are nearly dependent.

### ما مدى دقة «⁨حل أنظمة المعادلات الخطية⁩»؟

تعتمد الدقة على مدخلاتك وافتراضات الطريقة. يستخدم الحساب العشري 50 رقمًا معنويًا، لكن التقديرات والأساليب العددية وبيانات المصدر قد تكون أقل دقة؛ تقريب القيم المعروضة لا يزيل هذه الحدود. أمثلة محلولة جرى التحقق منها بمصادر مستقلة: 5. مثلًا، يجري التحقق من «⁨Wikipedia 3×3 example⁩» بالرجوع إلى ⁨Wikipedia “Gaussian elimination” example; Python fractions: det = −1, ‖A‖∞ = 6, ‖A⁻¹‖∞ = 10⁩.

### ما مصدر هذه الطريقة؟

Wikipedia — Gaussian elimination (worked 3×3 example); Wolfram MathWorld — Rouché–Capelli (Kronecker–Capelli) theorem: consistency by rank.

## المصادر

- [Wikipedia — Gaussian elimination (worked 3×3 example)](https://en.wikipedia.org/wiki/Gaussian_elimination)
- [Wolfram MathWorld — Rouché–Capelli (Kronecker–Capelli) theorem: consistency by rank](https://mathworld.wolfram.com/Rouche-CapelliTheorem.html)
