Motivated by the recent development of phase field methods for modeling and simulating the fracture of brittle and quasi-brittle materials, a general approach is proposed to decompose the infinitesimal strain tensor (or Cauchy stress tensor) into a positive part and a negative part which are orthogonal in the sense of an inner product where the elastic stiffness (or compliance) tensor acts as a metric. This approach is based on a strain (or stress) transformation preserving the elastic energy, and gives rise to a generalized Pythagorean theorem. It is valid not only for the isotropic elastic case but also for all the anisotropic ones. Decompositions of the strain (or stress) tensor are given in a coordinate-free way. The main results obtained are illustrated and detailed for the elastic isotropic case in an analytical explicit manner.