  The decomposition of an image into a linear combination of digitised basis
functions is an everyday task in astronomy. A general method is presented for
performing such a decomposition optimally into an arbitrary set of digitised
basis functions, which may be linearly dependent, non-orthogonal and
incomplete. It is shown that such circumstances may result even from the
digitisation of continuous basis functions that are orthogonal and complete. In
particular, digitised shapelet basis functions are investigated and are shown
to suffer from such difficulties. As a result the standard method of performing
shapelet analysis produces unnecessarily inaccurate decompositions. The optimal
method presented here is shown to yield more accurate decompositions in all
cases.

Astrophysics