In permanent-magnet (PM) electrical machines, a key role of PM material is to induce a voltage in a winding upon a relative movement of the PM about that winding. Although useful, PMs are costly and machine designers should optimize the contribution of all the volume elements in PMs as much as possible. This paper presents a new mathematical expression for the no-load flux linkage generated by PMs. The mathematical expression gives the flux linkage in terms of the PM geometry. This proves to be efficient in evaluating the contribution of each local magnet volume element to generate a no-load flux linkage. We propose a method that uses the derived mathematical expression to optimize the shape of PMs, and this method is applied to the case of a conventional PM synchronous machine. The optimization process uses the results from finite-element analysis, and the resulting PM shape shows an increase of voltage induced per PM volume.