How attributes helps us to allow column interchange in a relational database?

A relation on two sets A and B is defined as the subset of the cartesian product A X B = {(a,b), a $in$ A and b $in$ B}.

A database is also a relation and each entry is an ordered tuple respecting the cartesian product.

Now, interchanging the rows and the columns of a database does not change it. I can understand that a relation is just a set of tuples (called as row) so the order of elements in a set does not matter and hence row interchange will not pose a problem. But column interchange conflicts with the idea that a particular entry of the database is an ordered tuple.

So, attributes are used to tackle this problem. This is what I was told (verbatim):

Example table:

       Name    Roll No.

       Alex       2

       Fred       5

       Nate       7

=> Fix a set C also called the index set ( here it can be {1,2} or {Name, Roll No.} )

=> Consider:: {A i | i $in$ C}, A i is the “type” of the attribute i (here that is A 1 = String and A 2 = Integer).

=> The cartesian product: $Pi$ i A i is seen as the collection of functions f : C $to$ $cup$ i A i such that f ( i ) $in$ A i

I was told that this definition of the cartesian product will allow us not to worry about the position of the column ‘Name’, etc. But I did not understand why. I would appreciate any kind of help and I apologize in advance for bad/incorrect formatting.