We derive compact expressions of the second-order derivatives of bond length, bond angle, and proper and improper torsion angle potentials, in terms of operators represented in two orthonormal bases. Hereby, simple rules to generate the Hessian of an internal coordinate or a molecular potential can be formulated. The algorithms we provide can be implemented efficiently in high-level programming languages using vectorization. Finally, the method leads to compact expressions for a second-order expansion of an internal coordinate or a molecular potential. © 2014 Wiley Periodicals, Inc.