Let $\text{M}\_n(R)$ be the ring of $n$-by-$n$ matrices with entries in a commutative unital ring $R$. Theorem III in



> 
> C.R. Yohe, *Triangular and Diagonal Forms for Matrices over Commutative Noetherian Rings*, J. Algebra **6** (1967), 335-368
> 
> 
> 


provides a characterization of the *Noetherian* rings $R$ with the property that every matrix in $\text{M}\_n(R)$ is [equivalent](https://en.wikipedia.org/wiki/Matrix_equivalence) to a diagonal matrix: It turns out that this is the case if and only if $R$ is a direct sum of PIDs and completely primary PIRs, where ``completely primary'' means a local ring with a nilpotent maximal ideal. With this in mind, here are my questions:



> 
> (1) Is there any analogous characterization for the rings $R$ with the property that every matrix in $\text{M}\_n(R)$ is equivalent to an upper triangular matrix? (2) Does the property hold for *any* choice of $R$? (3) And if the answer to the previous question is no, what if we restrict attention to the *regular* matrices in $\text{M}\_n(R)$?
> 
> 
> 


*[EDIT]* The answer to questions (2) and (3) is in the negative, as shown by Mohan in [their answer](https://mathoverflow.net/q/361083), and that's good to know. On the other hand, I'm really hoping for someone to come up with a reference where it's actually proved that, if $R$ is taken from a class of commutative rings that is sufficiently interesting and sufficiently larger than direct sums of PIDs and completely primary PIRs, then every regular square matrix with entries in is equivalent to an upper triangular matrix. This would not be a characterization in the vein of Yohe's theorem, but still... *[END OF EDIT]*


Every matrix $A \in \text{M}\_n(R)$ can be brought to upper triangular form by elementary row transformations; that is, there exist [elementary matrices](https://en.wikipedia.org/wiki/Elementary_matrix) $E\_1, \ldots, E\_k \in \text{M}\_n(R)$ such that $E\_1 \cdots E\_k A$ is an upper triangular matrix. But the elementary matrix corresponding to a [row-multiplying transformation](https://en.wikipedia.org/wiki/Elementary_matrix#Row-multiplying_transformations) need not be invertible in $\text{M}\_n(R)$; although it is definitely invertible in $\text{M}\_n(\mathcal Q(R))$ when $A$ is regular, with $\mathcal Q(R)$ being the total ring of fractions of $R$. Unfortunatley, I don't see how this helps answering any of my questions (I'm especially interested in the last one).


*Glossary.* By a ``regular matrix'', I mean a regular element in the multiplicative monoid of $\text{M}\_n(R)$; or equivalently, a matrix $A \in \text{M}\_n(R)$ whose determinant is a regular element of $R$. An element $a$ in a (multiplicatively written) monoid $H$ is *regular* (or *cancellable*) if the functions $H \to H: x \mapsto ax$ and $H \to H: x \mapsto xa$ are both injective.



Rings $R$ such that every [regular] square matrix with entries in $R$ is equivalent to an upper triangular matrix
As Luc Guyot mentioned, check out Kaplansky's paper *[Elementary Divisors and Modules](https://www.ams.org/journals/tran/1949-066-02/S0002-9947-1949-0031470-3/S0002-9947-1949-0031470-3.pdf)* from 1949.


Kaplansky calls a ring Hermite when every $1 \times 2$ matrix is equivalent to a diagonal matrix, and shows that equivalently **a ring is Hermite iff for every matrix $M$ there exists an invertible matrix $U$ such that $MU$ is upper triangular.**


To get a finite product decomposition result like Yohe's, we obviously need to assume that $R$ has finitely many minimal primes.


On the other hand, we have the following



> 
> **Theorem** If $R$ is a Bézout ring with finitely many minimal primes then there is a finite set of idempotents $e\_i$ such that the ring $e\_iR$ is a Hermite ring with a unique minimal prime and $R \cong \prod e\_iR$. Hence $R$ is Hermite.
> 
> 
> 


This is Theorem 2.2 in *[Elementary Divisor Rings and Finitely Presented Modules](https://www.ams.org/journals/tran/1974-187-00/S0002-9947-1974-0335499-1/S0002-9947-1974-0335499-1.pdf)* by Larsen, Lewis, and Shores.


Maybe we can say more about the structure of these summands. For example, it is easy to show that in any Bézout ring with a unique minimal prime $P$, the ideal $P$ is essential unless $R$ is a domain. Indeed, if $I \cap P = 0$, then $\operatorname{Ann}(a) = P$ for any $a \in I$ and clearly any $a \in I$ is nonzero in every localization of $R$. Since $R$ locally has totally ordered ideals, this implies that $P$ is locally $0$, hence $0$, i.e. $R$ is a domain.


So to sum up



> 
> **Conclusion** Let $R$ be a ring with finitely many minimal prime ideals. Then the following are equivalent:
> 
> 
> $\ \ (1)$ $R$ is a finite direct product of Bézout rings each of which is either a domain or has a unique minimal prime ideal which is essential.
> 
> 
> $\ \ (2)$ Matrices over $R$ are equivalent to triangular matrices.
> 
> 
> 


I'm not sure if you can say very much in general about the structure of Bézout rings with essential unique minimal prime ideal. But, here's one observation: **A Bézout ring with a unique minimal prime ideal $P$ has the property that every non-nilpotent element divides every nilpotent element.**


Indeed, let $b$ be nilpotent and let $a$ be not nilpotent, i.e. $b \in P$ and $a \notin P$. By Bézoutness, pick $c,d,u,v,r$ such that $ac + bd = r$, $ru = a, rv = b$. Deduce that $r \notin P, v \in P$. It follows that $cv + du -1 \in P$, and we deduce that $du$ is a unit. Therefore $a \mid b$.


Note that if $R$ is additionally Noetherian, we can easily deduce that $P$ is the unique prime ideal of $R$, which exactly recovers Yohe's result. To see this, note first that it suffices to assume $R$ is local with maximal ideal $M$, in which case it has totally ordered ideals and $\bigcap\_n M^n = 0$, which implies $M^n \subseteq P$ for some $n$ and thus $M \subseteq P$. Without the Noetherian hypothesis, $R$ can have infinite Krull dimension.


As for your 3rd question, I don't have much to say off the top of my head except that it seems really hard. From your own observations, any ring which is its own total ring of fractions (i.e. regular elements are units) will have this property, and that is quite a broad class of rings, members of which sometimes have ostensibly very little in common.


