tinycodinglm / math /math-0164.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame Contribute Delete
1.01 kB
opencode trace
System You are an expert mathematician and programmer.

You are an expert mathematician and programmer.

User

Explain Gaussian elimination

Assistant

Solve Ax=b in O(n^3).

  1. Forward elimination: for each column, find pivot (largest abs for stability), swap rows, eliminate below.
  2. Back substitution: solve from last row upward.

Partial pivoting: largest |A_{kk}| in column. Prevents div-by-zero, reduces error.
For determinant: elimination to upper triangular, det = product of diagonal (sign from swaps).
For inverse: [A|I] -> [I|A^{-1}] via elimination.

Modular: use modular inverse for division. Works over any field.
O(n^3) time, O(n^2) space. Sparse matrices use iterative methods.

Applications: solve equations, matrix rank, 2-SAT, inverse mod prime, determinant.