Step 1: Definition of an identity matrix.
An identity matrix \( A = [a_{ij}] \) is a square matrix in which all the diagonal elements are \( 1 \), and all off-diagonal elements are \( 0 \). Mathematically:
\[ a_{ij} = \begin{cases} 1, & \text{if } i = j, \\ 0, & \text{if } i \neq j. \end{cases} \]
Step 2: Analyze each option.
(A) \( a_{ij} = 0 \) if \( i = j \) and \( a_{ij} = 1 \) if \( i \neq j \): This is incorrect because it contradicts the definition of an identity matrix.
(B) \( a_{ij} = 1, \forall i, j \): This is incorrect because an identity matrix has \( 0 \) for all off-diagonal elements.
(C) \( a_{ij} = 0, \forall i, j \): This is incorrect because it implies all elements are \( 0 \), which is not an identity matrix.
(D) \( a_{ij} = 0 \) if \( i \neq j \) and \( a_{ij} = 1 \) if \( i = j \): This is correct, as it matches the definition of an identity matrix.
Final Answer: \( \boxed{(D)} \)