This should help with multivariable traces: https://openstax.org/books/calculus-volume-3/pages/4-1-functions-of-several-variables