1 of 2

Julia, 9 bytes

n->eye(n)

This is a lambda function that accepts an integer n and returns an nxn Array{Float64,2} (i.e. a 2D array). To call it, assign it to a variable.