The tangent of each element of X is returned by Y = tan(X). On arrays, the tan function executes element-by-element. Both real and complex inputs are accepted by the function. tan(X) returns real values in the interval [-∞, ∞].