triangles and matrix multiplication