1001Ferramentas
Calculators

Matrix Trace

Computes the trace (main diagonal sum) of a square matrix of any order entered inline.

Matrix trace

The trace of a square matrix A is just the sum of the entries down its main diagonal: tr(A) = a₁₁ + a₂₂ + … + aₙₙ. A couple of properties make it useful. It's linear (tr(A+B) = tr(A)+tr(B) and tr(cA) = c·tr(A)), and it stays the same under similarity: tr(P⁻¹AP) = tr(A). In other words, the trace belongs to the linear operator itself and doesn't care which basis you wrote the matrix in. One more handy fact is that it equals the sum of the eigenvalues, counted with multiplicity.

Example: for A = [[1,2,3],[4,5,6],[7,8,9]], tr(A) = 1 + 5 + 9 = 15.

Applications

You'll run into the trace all over the place. In PCA it gives the total variance, since that's the trace of the covariance matrix. Machine learning normalizations such as BatchNorm and LayerNorm lean on it when they center by per-feature mean. In spectral theory it hands you the eigenvalue sum without making you diagonalize anything. And in physics it shows up as the partial trace of density matrices in quantum mechanics, or the trace of the stress tensor in continuum mechanics.

FAQ

Why is trace invariant under similarity? It comes down to one fact: tr(AB) = tr(BA) holds for any compatible A and B. Group the factors as tr(P⁻¹·(AP)) = tr((AP)·P⁻¹) = tr(A) and you're done.

Does trace work for non-square matrices? No. It's defined only for square matrices, because you need a main diagonal where the row and column indices line up.

Trace vs determinant? The trace adds the eigenvalues up; the determinant multiplies them together. Both are scalars that don't depend on the basis, but each tells you something the other doesn't.

Related Tools

🪨

Density-Log Porosity

Compute a reservoir rock's porosity from the density log, φ = (ρma − ρb)/(ρma − ρf), where ρma is the matrix (mineral) density, ρb the bulk density read by the log and ρf the pore-fluid density. It is one of the most used petrophysical methods to estimate porosity in wells, since the bulk density drops as the pore volume (filled by less dense fluid) increases. Enter the matrix, bulk (log) and fluid densities.

🔲

2x2 Matrix Determinant and Inverse

Calculate the determinant and inverse of a 2x2 matrix from its four entries. See the step-by-step and the exact result in fractions or decimals.

📋

Vegetable Seedling Spacing Lookup

Pick lettuce, tomato, carrot, onion, arugula or basil and read the recommended row × plant spacing in cm, from carrot 25×8 cm to tomato 100×60 cm.

🪟

Composite Modulus (Rule of Mixtures)

Calculate the longitudinal elastic modulus of a composite by the rule of mixtures, E_c = E_f·V_f + E_m·(1 − V_f), from the fiber modulus (E_f), the fiber volume fraction (V_f) and the matrix modulus (E_m). The result, in the modulus unit (GPa), is the modulus in the fiber direction (Voigt upper bound), assuming equal strain in fiber and matrix. It shows the composite stiffness is a volume-weighted average — stiff fibers (carbon, glass) at high fraction greatly raise the modulus. In the transverse direction, the inverse rule of mixtures (Reuss bound) applies, much lower. Enter the fiber modulus, the fiber fraction and the matrix modulus.

🌱

EV CO2 Emissions by Source

Estimates annual CO2 emissions of an EV by grid source.

🔢

Matrix 3x3 Determinant

Computes the determinant of a 3x3 matrix from its 9 inline elements.

The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.