Unique word (UW-) OFDM is a novel multicarrier system that is shown to be suitable for cognitive radio systems. To construct the UW-OFDM signal, a code generation matrix is required to introduce redundancy in the frequency domain, implying that the code generation matrix must satisfy a number of conditions. In this paper, we use an algebraic construction method to separate the conditions imposed by the signal shape from the code design. The degrees of freedom resulting from this construction method are used to optimize different performance measures (i.e., the minimum Euclidean distance and the power) at the transmitter or at the receiver side. Based on the algebraic decomposition, a composite channel can be defined. Irrespective of whether the optimization is done at the transmitter or the receiver, we shown in the paper that always the strongest modes of this composite channel must be excited.