The find_index is an inbuilt method in Ruby returns the index position of the given number. If the element is present more than once, the first occurrence is returned. If the element is not present, then nil is returned.
Parameters: The function needs an element which is to be searched in matrix mat1.
Return Value: It returns the row number and column number where the element is.