Gerstenhaber's theorem states that the dimension of the unital algebra generated by two commuting n×n matrices is at most n . We study the analog of this question for positive matrices with a positive commutator. We show that the dimension of the unital algebra generated by the matrices is at most and that this bound can be attained. We also consider the corresponding question if one of the matrices is a permutation or a companion matrix or both of them are idempotents. In these cases, the upper bound for the dimension can be reduced significantly. In particular, the unital algebra generated by two semi-commuting positive idempotent matrices is at most 9-dimensional. This upper bound can be attained.