Let R be an associative ring with identity 1. We describe all matrices in Tn(R) the ring of n × n upper triangular matrices over R (n ∈ N), and T∞(R) the ring of infinite upper triangular matrices over R, satisfying the quadratic polynomial equation x 2 − rx + s = 0. For such propose we assume that the above polynomial have two different roots in R. Moreover, in the case that R in finite, we compute the number of all matrices to solves the matrix equation A 2 − rA + sI = 0, where I is the identity matrix.