Examining a transformation

I couldn't think a lot on this problem and I'd like to know whether my way of thinking is not wrong.

Determine whether the following transformation is invertible and in case of being invertible, give its inverse.

Let be defined by .

My attempt : Well I think that it has an inverse and that it's .

But I'd love to know how I could find a general way to determine if a transformation has an inverse. I guess by writing its matrix with respect to the canonical basis (or any other basis) and check out if the matrix is invertible... But I'm not sure. Nor I'm sure how to write such a matrix in this example.