The Cartesian product of two sets and , denoted as , is the set of all ordered pairs where the first element is from and the second element is from .