tcrossprod() function in R Language is used to return the cross-product of the transpose of the specified matrix.
Syntax: tcrossprod(x)
Parameters:
x: numeric matrix
Example 1:
# R program to illustrate # tcrossprod function # Initializing a matrix with # 2 rows and 2 columns x <- matrix(1:4, 2, 2) # Getting the matrix representation x # Calling the tcrossprod() function tcrossprod(x) |
chevron_right
filter_none
Output:
[, 1] [, 2]
[1, ] 1 3
[2, ] 2 4
[, 1] [, 2]
[1, ] 10 14
[2, ] 14 20
Example 2:
# R program to illustrate # tcrossprod function # Initializing a matrix with # 3 rows and 3 columns x <- matrix(1:9, 3, 3) # Getting the matrix representation x # Calling the tcrossprod() function tcrossprod(x) |
chevron_right
filter_none
Output:
[, 1] [, 2] [, 3]
[1, ] 1 4 7
[2, ] 2 5 8
[3, ] 3 6 9
[, 1] [, 2] [, 3]
[1, ] 66 78 90
[2, ] 78 93 108
[3, ] 90 108 126
Recommended Posts:
- Get Transpose of a Matrix or Data Frame in R Programming - t() Function
- Matrix Transpose in R
- Calculate the Sum of Matrix or Array columns in R Programming - colSums() Function
- Calculate the Mean of each Column of a Matrix or Array in R Programming - colMeans() Function
- Calculate the cross-product of a Matrix in R Programming - crossprod() Function
- Calculate Trace of a Matrix in R Programming - tr() Function
- Calculate arc cosine of a value in R programming - acos() function
- Calculate arc tangent of a value in R programming - atan2(y, x) function
- Calculate cosine of a value in R Programming - cos() Function
- Calculate Hyperbolic cosine of a value in R Programming - cosh() Function
- Calculate sine of a value in R Programming - sin() Function
- Calculate Hyperbolic sine of a value in R Programming - sinh() Function
- Calculate Hyperbolic tangent of a value in R Programming - tanh() Function
- Calculate tangent of a value in R Programming - tan() Function
- Calculate Inverse sine of a value in R Programming - asin() Function
- Calculate Inverse cosine of a value in R Programming - acos() Function
- Calculate Inverse tangent of a value in R Programming - atan() Function
- Calculate exponential of a number in R Programming - exp() Function
- Calculate Factorial of a value in R Programming - factorial() Function
- Calculate nCr value in R Programming - choose() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

