Most electronic structure algorithms and codes yield energy gradients in cartesian coordinates. For the first time we derived fully analytical expressions for the Jacobian matrices of the coordinate transformations between cartesian and Z-matrix coordinates which allow the analytical transformation of energy gradients to Z-matrix coordinates. We would like to emphasize that this is fundamentally different from the more common non-hierarchical internal coordinates. There is an impressive body of work on the latter. We use the term nonhierarchical to refer to redundant internal coordinates and non-redundant/natural 21 internal coordinates that are derived from them as linear combinations. They all have in common that they do not require implicit information about order. In particular the analytical transformation of gradients for the non-hierarchical internal coordinates is known for a long time and obtained via the Wilson B matrix which also allows constraints, where linear combinations of coordinates are kept constant. The difference between hierarchical and non-hierarchical coordinate sets is particularly clear, when building the gradients.