If matrix A has x rows and x + 5 columns, matrix B has y rows and 11 – y columns and both AB and BA are defined for product then x and y are:

AB => x+5 = y

BA => 11-y = x

So, just solve for x and y.