Let R is an element of C-mxm and S is an element of C-mxn be nontrivial unitary involutions, i.e., R-H = R = R-1 not equal I-m and S-H = S = S-1 not equal I-n. We say that G is an element of C-mxn is a generalized reflexive matrix if RGS = G. The set of all in x it generalized reflexive matrices is denoted by GRC(mxn). In [his paper, a sufficient and necessary condition for the matrix equation AXB = D, where A is an element of C-pxm, B is an element of C-nxq, and D is an element of C-pxq, to have a solution X is an element of GRC(mxn) is established, and if it exists, a representation of the solution set S-X is given. An optimal approximation between a given matrix (X) over tilde is an element of C-mxn and the affine subspace S-X is discussed, all explicit formula for the unique optimal approximation solution is presented, and a numerical example is provided. (c) 2008 Elsevier Ltd. All rights reserved.