On the representations of a number as a sum of squares and certain related identities