In multiple-input-multiple-output (MIMO) transmission, precoding has been considered a promising technique to improve the system performance. In general, the criterion of precoder design depends on the detector used at the receiver. For the maximum-likelihood (ML) detector, the criterion is to maximize the minimum distance of the received signal constellation. Unfortunately, the derivation of the optimum solution is known to be difficult, and suboptimum solutions have then been developed. One promising approach confines the precoder having an X-structure. Several methods have been developed to solve the X-structured precoder. However, most of them use numerical searches to find their solutions and require lookup tables during run time. In this paper, we propose a systematic design method to solve the problems. The proposed precoder has a simple closedform expression, and no numerical searches and lookup tables are required. Simulation results show that the proposed method can yield almost the same performance as the existing methods. We also consider the problem of joint source/relay precoder design in a two-hop amplify-and-forward MIMO relay system. Since the problem is much more involved and a closed-form solution is intractable to find, we then extend the use of the proposed X-structured precoder so that the problem can be reformulated as a simple scalar-valued optimization problem. Simulations show that the proposed method can significantly outperform existing joint design methods.Index Terms-Free distance, geometric mean decomposition (GMD), maximum-likelihood (ML) detection, MIMO, multiple-input-multiple-output (MIMO) relay systems, spatial multiplexing, X-structured precoder.