I'm now working on final project for my graduation, which is a ray casting application with bump mapping. But now I'm stuck with how to inverse a 4x4 Matrix that I need to convert light vectors from object space to tangent space. I'm searching all the whole internet, but only can find a 3x3 Matrix inverse, but not 4x4 one.\n\nI've also learnt that I can inverse a matrix by using adjoint-cofactor theory. But, as again, it's method only shows how to work under 3x3 Matrix. It's not that similar in analogy, because it involves matrix transpose on somewhere around.\n\nAre there people can help me with how to invert 4x4 Matrix? Code will be much better, but just the theory will be ok though.\n\nsome of the good reference (but not helping) I have found so far:\nhttp://en.wikipedia.org/wiki/Invertible_matrix\nhttp://home.earthlink.net/~w6rmk/math/matinv.htm\n\nthanks before! :)
206862
0 1 0 0\n0 0 1 0\n1 0 0 0\n0 0 0 1\nPut the identity matrix behind your matrix.\nTurn you matrix into the identity matrix using row operations.  The matrix in the back will be the inverse.\n0 1 0 0  1 0 0 0 \n0 0 1 0  0 1 0 0 \n1 0 0 0  0 0 1 0 \n0 0 0 1  0 0 0 1\nSwap row 1 with row 3\n1 0 0 0  0 0 1 0 \n0 0 1 0  0 1 0 0 \n0 1 0 0  1 0 0 0 \n0 0 0 1  0 0 0 1\nSwap row 2 with row 3\n1 0 0 0  0 0 1 0 \n0 1 0 0  1 0 0 0\n0 0 1 0  0 1 0 0 \n0 0 0 1  0 0 0 1\nThus, the inverse is\n0 0 1 0\n1 0 0 0\n0 1 0 0 \n0 0 0 1
286133
I can do it... but let me think a little on it.  Can I take the full 4 months?  :-)\n\nOkay, I think I have a solution... took me about 5 minutes I think:\n\nIf I move the dot from B1 -> B2 and C1 -> C2, then B and C will still have 4 dots, and row four will still have 4 dots, but now row two will have 4 dots.\n\nYou didn't say they couldn't share the same square!!!!\n------------\nI'm back\n\nYou didn't exactly state what a "row" was.  I would have called that a "line" but maybe that's what you meant.\n\nOkay, I have a couple revised solutions.  A "row" is now defined as 4 dots that are colinear (on the same line) but each point must be distinct.  This invalidates my previous answer.\n\nOne solution matches with what has already been stated, which is:\nA4 --> B5  and  D4 --> C5.  This makes two pairs of overlapping lines each with 4 dots.\n\nHowever, my new solution is to take C1 and place it halfway between columns B and C and halfway between rows 2 and 3.\n\nThen you have a line on row 4, a line on column B, and two diagonal lines!!!!\n\nOne dot moved, 4 lines created!!!!\n\nAnd if you *must* move two dots, then just move B1 --> B5 and you still have a valid answer.
416500
Rather, by drawing a ray diagram you will see tt since the object is placed BETWEEN the focal point and the 'second focal point' (which is 2 x the focal length from the verticle), the image formed will be real, magnified and inverted.\n\nYou may want to check out the other variations for objects placed BEFORE the focal point, AT the focal point, AT 2 focal points away, or BEYOND 2 focal points as well.\n\nI dunno of any equation but i doubt there are any. the answer to ur qn is more of how does the object looks like. and to find out the size of the image it very much depends on the lens used. and perhaps you can apply some trigo.
471603
Using matices to do this\n\n[ 1 -2 1] * [x] = [-5]\n[ 2 -1 1]   [y]    [ 1]\n[2  1  2]   [z]    [10]\n\nAX = B\nA*A^(-1)X = A^(-1)B\nX = A^(-1)B\n\nSO we need the inverse of A this can be worked out using a long and tedious method or just use a calculator\n\nA^-1 = [ -.6 1 -.2]\n           [ -.4 0   2]   \n           [.8   -1 .6]\n\nA^-1B = [2}\n              [4}\n              [1]\nso x =2  y=4 z=1\n\n now you do the other one\nCheck\n2 - (4*2) +1 = 2 - 8 +1 = -5
299922
I would convert both vectors to cartesian form using simple trigonometry. 250 degrees is a 3rd quadrant angle so its sine and cosine are -cos(70) and -sin(70) respectively.\n\nA is (-13 cos(70), -13 sin(70)) = (-4.4463, -12.2160)\n\nA quick check here: square these numbers and add them together, and you get 169.0000, which means I've got the right answer so far, by Pythagoras. \n\nSimilarly \nB is (-27 cos(60), +27 sin(60)) = (-13.5, +23.383)\n\nSame check still says I am on the right track. \nBut note that these things are vectors so you write them with the x displacement above the y displacement, not on one line as I have because I'm using a dumb keyboard instead of a pencil like real mathematicians do. \n\nA + B = (-4.4463, -12.2160) + (-13.5, +23.383)\n= (-16.6623,  +11.167)\n= (-16.66, +11.17) to 2 dp\n\nC = A - B = (-4.4463, -12.2160) - (-13.5, +23.383)\n= (+9.0537, -35.599)\n= (+9.05, -35.60) to 2 dp\n\nIf you prefer, you can convert the vectors back into polar form\n\nA + B = (-16.6623,  +11.167)\nx is -ve and y is +ve so this is a 4th quadrant angle\narctan(16.6623/11.167) = arctan(0.670196) = 33.8298 deg\nSo the angle of A + B is 33.83 + 270 = 303.83 deg to 2 dp\nThe length of the vector by Pythagoras again, jolly useful fellow he must have been\n16.6623^2 + 11.167^2 = 402.334 = 20.0583^2\nSo A + B = 20.06 in a direction 303.83 deg\n\nSimilarly\nC = (+9.0537, -35.599)  2nd quadrant angle\narctan(35.599/9.0537) = 75.7308 deg\n90 + 75.7308 = 165.7308\n9.0537^2 + 35.599^2 = 36.7323^2\nHence the vector C is 36.73 in a direction 165.73 to 2 dp
44950
A 100 by 100 matrix has 100 eigenvectors. I would use some software to do this. This is too hard to do by hand. Buy the student version of MATLAB for example. You might be able to find some free software on the internet as well.
23543
To use pointer with 2D matrix it is better to use pointer to a pointer. It can be used like usual 2D array.\nCode in main should be something like below\n//input dimension from user, m by n matrix\nint** matrix;\nmatrix=new int*[m];\nfor( i=0;i<m;i++)\nmatrix[i]=new int[n];\n// now input matrix from user in usual way.\n\nnow you can use this pointer to pointer as usual 2D array, when calling function just pass pointer to pointer as argument.\nI have said you how to raotate 2D array in your previous question. I'm just repeating procedures, not the code.\nFirst transpose the matrix and then reflect it wrt horizontal axis. I think this will work.
142355
Diagonalisation is the answer here.  Not sure how this didn't turn up in a web search, as I found plenty of resources for it, but the idea is that you find a matrix that diagonalises your initial matrix, and this allows powers to be done trivially.\n\nAssuming you're aiming to get a matrix A to the power n:\n\nFind P such that:\nP^-1 A P = D, where D is diagonal.  Then:\nA = (P D P^-1) and:\nA^n = (P D P^-1)(P D P^-1)(P D P^-1)....\n\nThe P^-1 P terms cancel and you're left with:\nA^n = P D^n P^-1\n\n... and this is much easier to calculate as D^n is trivial :)\n\nA good reference is in the sources.  Hope that helps!
29309
I recommend purlplemath.com.  i'm not sure how helpful it is overal, but i like how they explain matrix multiplication <http://www.purplemath.com/modules/mtrxmult.htm>.  you can also do a web search for the subject you have a problem with, there are plenty of sites.  and your teacher should love to help you.
487695
That equation is just the following when written as a matrix (// = new line)\n[ 2.7 -3.5 // 6.3 4][x // y] = [13.35 // 12.9]\nNow, you need to find the inverse of the left hand matrix. The inverse of [a b // c d] is 1/(ad-bc) * [d -b // -c a].\nSo, the inverse is 1/32.85 * [4 3.5 // -6.3 2.7].\nSo, multiplying both sides by that:\n[x // y ] = 1/32.85 * [4 3.5 // -6.3 2.7][13.35 // 12.9].\nMultiplying that out gives [x // y] = [3 // -1.5]
337603
You need to switch to the Projection Matrix when you are specifying the projections. \ne.g.\n glMatrixMode( GL_PROJECTION );\n glLoadIdentity();\n gluPerspective( 60.0, aspectRatio, 1.0, 30.0 );\n\n\nThe model view matrix is used for the rotation, scaling and translation stuff. So, you need to do glMatrixMode(GL_MODELVIEW) before you do your transformations.
486233
x=t^2 - 1\ny=t^4 - 4t\n\ntangent vector: ( 2t, 4t^3 -4)\nthe tangent vector is horizontal if:4t^3 -4 =0, so t^3=1, so t=1,\nin this case\nx= 0, and y = 1-4=-3\n\nthe tangent vector is vertical if: 2t=0, so t=0\nin this case\nx= -1 and y= 0\n`
568302
Use the Dot product as for 2D vectors\nA . B = |A||B|cos(angle)\ncos(angle) = dot product divided by the product of the magnitude of the vectors\nUse inverse cosine to find the angle.\nExample:\nA = 4i + 4j + 2k (i,j, and k are unit vectors in x,y,z respectively)\nB = 2i + 3j + 5k\n\nA.B = (2)(4) + (4)(3) + (2)(5) = 8 + 12 + 10 =20\n|A| = sqrt of (4x4 + 4x4 + 2x2) = sqrt of (36) = 6\n|B| = sqrt of (2x2 + 3x3 + 5x5) = sqrt of (38) =~ 6.16\n\ncos(angle) =  20/(6x6.16) = 20/36.96 = 0.54\nThe angle = arccos(.54) = 57 degrees\n\nThere is plenty of stuff here:\nhttp://mathworld.wolfram.com/topics/VectorAlgebra.html\n\nor start with Wikipedia \nhttp://en.wikipedia.org/wiki/Dot_product
595403
Let's start with an example of a vector space. An example is a plane. If we take any two points (we can make them vectors by drawing the points through the origin) in the plane and add them, the result will still be in the plane. If we take any scalar multiple of a vector in the plane, the result will still be in the plane. In fact, the resulting vector will be parallel to the original vector. \n\nIt's these two properties that make a vector space a vector space. In fact, what I said about the plane holds for any n-dimensional (n is any whole number that can be imagined) space. Further generalizations can be made to other examples that satisfy the addition and scalar multiplication properties mentioned above. But staying in the same space when adding or multiplying by a scalar are the key properties of a vector space.
86639
Think of this as a linear approximation thing. The Jacobian *matrix* is essentially the linear part of the approximation. Now use the fact that matrix multiplication is one-to-one when the matrix is invertible and not otherwise. We test invertibility of a square matrix by looking at its determinant. So, finally, the determinant of the Jacobian matrix is the Jacobian.\n\nOne thing you should be careful of, though. The above paragraph only works locally. It is possible for the Jacobian to never be 0, yet the global function to fail to be one-to-one.
495470
I know you want something more accurate than rÅvi suggested.  It's a long time since I dealt with this stuff, but do you do cross product and dot product?  If so, work out the cross product of two of them (i don't remember exactly how to do this and would have to play with it for maybe half an hour to work it out for myself), as this gives a vector perpendicular to the two vectors.\nThen work out the dot product (I do remember this one!  It's \nx1*x2 + y1*y2 + z1*z2)\nand if it's zero then the third vector is also perpendicular to the cross product, so the three of them are coplanar.\n\nIn brief, a condition for v1, v2, v3 to be in the same plane is\nv1.(v2xv3) = 0  where I've used . to represent dot because I don't know how to type a dot here.
407434
An identity matrix must be square, so 5 is true.  Inverses must multiply to the same answer in either order, so they must be square, so 2 is true.\n\nAny square matrix multiplied by its identity will equal itself, so 4 is false and 1 is true.\n\nInverses must multiply to come out the identity which is impossible if one matrix is all zeros, so 3 is true.