I'm still in high school so sorry if I do not know this. I learnt matrices in class and how to use them to rotate by $90^o,180^o,$ and $270^o$ with center (0,0). I played around with them later and came up with a matrix that would allow me to rotate a point $(x,y)$ with a center $(k,i)$ by $\theta_r$ in the clockwise direction where the angles are measured from the horizontal direction. Here is the matrix:
Where $d = \sqrt{(x-k)^2 + (y-i)^2} $ and $\theta_n = \theta_r + sin^{-1}(\frac{y-i}{d})$
$$ \begin{pmatrix} \frac{dcos\theta_n + k}{x} & 0 \\ 0 & \frac{dsin\theta_n + i}{y} \\ \end{pmatrix} $$
My question is if this formula exists and where can I find it and is there a much simpler matrix for it?
It looks like you’re trying to rotate about an arbitrary point $(k,i)$ in the plane instead of about the origin. Unfortunately, this can’t be represented by a $2\times2$ matrix because such a transformation isn’t linear—it fails to be such because it doesn’t leave the origin fixed. Also, having the coordinates of the point that you’re trying to transform appear in the matrix doesn’t work very well—you ought to be able to apply the same matrix to any point to transform it in the same way. There’s also the problem that this matrix is undefined for $x=0$ or $y=0$.
The transformation you’re trying to represent can be broken down into three steps: a translation of the origin to the center of rotation, a rotation about this new origin, then a translation back. When you put this all together, you end up with the following: $$\begin{align} x'&=(x-x_c)\cos\theta-(y-y_c)\sin\theta+x_c \\ y'&=(x-x_c)\sin\theta+(y-y_c)\cos\theta+y_c\end{align}$$ where I’ve used $(x_c,y_c)$ as the coordinates of the center of rotation and the direction of rotation is in the conventional counterclockwise direction.
Now, there is a way of representing this transformation as a matrix, but it requires using homogeneous coordinates. There are some rather interesting things going on when you use homogeneous coordinates, but for now, you can think of them as a way to include a translation in the transformation matrix. Instead of $2\times2$ matrices, we use $3\times3$ and add a third coordinate with a value of $1$ to the coordinate vectors. The translation $(x,y)\to(x+a,y+b)$ is represented by the matrix $$T_{(a,b)}=\pmatrix{1&0&a\\0&1&b\\0&0&1}.$$ You can verify for yourself that if you multiply the column vector $(x,y,1)^T$ by this matrix, you get $(x+a,y+b,1)^T$. The matrix for a rotation about the origin is just the normal $2\times2$ matrix filled out with a $1$ in the lower-right corner and zeroes everywhere else: $$R_\theta=\pmatrix{\cos\theta&-\sin\theta&0\\\sin\theta&\cos\theta&0\\0&0&1}.$$ To get the matrix for the transformation that you want, we multiply the matrices for the three steps together, going from right to left:$$\begin{align}T_{(x_c,y_c)}R_\theta T_{(-x_c,-y_c)}&=\pmatrix{1&0&x_c\\0&1&y_c\\0&0&1}\pmatrix{\cos\theta&-\sin\theta&0\\\sin\theta&\cos\theta&0\\0&0&1}\pmatrix{1&0&-x_c\\0&1&-y_c\\0&0&1} \\ &=\pmatrix{\cos\theta&-\sin\theta&-x_c\cos\theta+y_c\sin\theta+x_c \\ \sin\theta&\cos\theta&-x_c\sin\theta-y_c\cos\theta+y_c\\0&0&1}.\end{align}$$ Applying this matrix to the point to be rotated gives $$\pmatrix{\cos\theta&-\sin\theta&-x_c\cos\theta+y_c\sin\theta+x_c \\ \sin\theta&\cos\theta&-x_c\sin\theta-y_c\cos\theta+y_c\\0&0&1}\pmatrix{x\\y\\1}=\pmatrix{(x-x_c)\cos\theta-(y-y_c)\sin\theta+x_c \\ (x-x_c)\sin\theta+(y-y_c)\cos\theta+y_c \\ 1}$$ as before. Notice that, for this limited use of homogeneous coordinates, the last coordinate will always be $1$, and the last row of a transformation matrix will always be $\pmatrix{0&0&1}$.
Addition: In case you haven’t seen the formula for a rotation about the origin through an arbitrary angle before, here’s a simple derivation: use polar coordinates $x=\rho\cos\phi$, $y=\rho\sin\phi$ and apply the trigonometric identities for sums of angles: $$x'=\rho\cos(\phi+\theta)=\rho\cos\phi\cos\theta-\rho\sin\phi\sin\theta=x\cos\theta-y\sin\theta \\ y'=\rho\sin(\phi+\theta)=\rho\cos\phi\sin\theta+\rho\sin\phi\cos\theta=x\sin\theta+y\cos\theta.$$